mirror of
https://github.com/tuono-labs/tuono
synced 2026-07-25 12:52:47 -07:00
feat(env): setup env prefix and typescript for client-side (#584)
This commit is contained in:
@@ -11,3 +11,6 @@ node_modules
|
||||
.tuono
|
||||
out
|
||||
target
|
||||
|
||||
# Ignore local env files
|
||||
*.local
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"types": ["tuono/build-client"],
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
|
||||
@@ -11,3 +11,6 @@ node_modules
|
||||
.tuono
|
||||
out
|
||||
target
|
||||
|
||||
# Ignore local env files
|
||||
*.local
|
||||
|
||||
@@ -1,4 +0,0 @@
|
||||
declare module '*.module.css' {
|
||||
const classes: Record<string, string>
|
||||
export default classes
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"jsx": "react-jsx",
|
||||
"useDefineForClassFields": true,
|
||||
"types": ["tuono/build-client"],
|
||||
|
||||
// Modules
|
||||
"module": "ESNext",
|
||||
|
||||
@@ -11,3 +11,6 @@ node_modules
|
||||
.tuono
|
||||
out
|
||||
target
|
||||
|
||||
# Ignore local env files
|
||||
*.local
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"types": ["tuono/build-client"],
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
|
||||
@@ -11,3 +11,6 @@ node_modules
|
||||
.tuono
|
||||
out
|
||||
target
|
||||
|
||||
# Ignore local env files
|
||||
*.local
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
"lib": ["ES2020", "DOM", "DOM.Iterable"],
|
||||
"module": "ESNext",
|
||||
"skipLibCheck": true,
|
||||
"types": ["tuono/build-client"],
|
||||
|
||||
/* Bundler mode */
|
||||
"moduleResolution": "bundler",
|
||||
|
||||
@@ -27,6 +27,9 @@
|
||||
"types": "./dist/esm/build/index.d.ts",
|
||||
"default": "./dist/esm/build/index.js"
|
||||
},
|
||||
"./build-client": {
|
||||
"types": "./dist/esm/build-client/index.d.ts"
|
||||
},
|
||||
"./config": {
|
||||
"types": "./dist/esm/config/index.d.ts",
|
||||
"default": "./dist/esm/config/index.js"
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
import 'vite/client'
|
||||
@@ -2,3 +2,4 @@ export const DOT_TUONO_FOLDER_NAME = '.tuono'
|
||||
export const CONFIG_FOLDER_NAME = 'config'
|
||||
export const CONFIG_FILE_NAME = 'config.mjs'
|
||||
export const SERVER_CONFIG_NAME = 'config.json'
|
||||
export const ENV_PREFIX = 'TUONO_PUBLIC_'
|
||||
|
||||
@@ -8,6 +8,7 @@ import type { TuonoConfig } from '../config'
|
||||
|
||||
import { blockingAsync } from './utils'
|
||||
import { createJsonConfig, loadConfig } from './config'
|
||||
import { ENV_PREFIX } from './constants'
|
||||
|
||||
const VITE_SSR_PLUGINS: Array<Plugin> = [
|
||||
{
|
||||
@@ -45,6 +46,7 @@ function createBaseViteConfigFromTuonoConfig(
|
||||
publicDir: '../public',
|
||||
cacheDir: 'cache',
|
||||
envDir: '../',
|
||||
envPrefix: ENV_PREFIX,
|
||||
|
||||
resolve: {
|
||||
alias: tuonoConfig.vite?.alias ?? {},
|
||||
|
||||
@@ -13,6 +13,7 @@ export default mergeConfig(
|
||||
'./src/index.ts',
|
||||
'./src/build/index.ts',
|
||||
'./src/config/index.ts',
|
||||
'./src/build-client/index.ts',
|
||||
'./src/ssr/index.ts',
|
||||
'./src/hydration/index.tsx',
|
||||
],
|
||||
|
||||
Reference in New Issue
Block a user