mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-08-27 04:21:11 +08:00
chore: config ts-config
This commit is contained in:
@@ -9,9 +9,6 @@ VITE_PUBLIC_PATH = /
|
|||||||
VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
|
VITE_PROXY = [["/basic-api","http://localhost:3000"],["/upload","http://localhost:3300/upload"]]
|
||||||
# VITE_PROXY=[["/api","https://vvbin.cn/test"]]
|
# VITE_PROXY=[["/api","https://vvbin.cn/test"]]
|
||||||
|
|
||||||
# Delete console
|
|
||||||
VITE_DROP_CONSOLE = false
|
|
||||||
|
|
||||||
# Basic interface address SPA
|
# Basic interface address SPA
|
||||||
VITE_GLOB_API_URL=/basic-api
|
VITE_GLOB_API_URL=/basic-api
|
||||||
|
|
||||||
|
@@ -4,9 +4,6 @@ VITE_USE_MOCK = true
|
|||||||
# public path
|
# public path
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# Delete console
|
|
||||||
VITE_DROP_CONSOLE = true
|
|
||||||
|
|
||||||
# Whether to enable gzip or brotli compression
|
# Whether to enable gzip or brotli compression
|
||||||
# Optional: gzip | brotli | none
|
# Optional: gzip | brotli | none
|
||||||
# If you need multiple forms, you can use `,` to separate
|
# If you need multiple forms, you can use `,` to separate
|
||||||
|
@@ -5,9 +5,6 @@ VITE_USE_MOCK = true
|
|||||||
# public path
|
# public path
|
||||||
VITE_PUBLIC_PATH = /
|
VITE_PUBLIC_PATH = /
|
||||||
|
|
||||||
# Delete console
|
|
||||||
VITE_DROP_CONSOLE = true
|
|
||||||
|
|
||||||
# Whether to enable gzip or brotli compression
|
# Whether to enable gzip or brotli compression
|
||||||
# Optional: gzip | brotli | none
|
# Optional: gzip | brotli | none
|
||||||
# If you need multiple forms, you can use `,` to separate
|
# If you need multiple forms, you can use `,` to separate
|
||||||
|
4
internal/eslint-config/tsconfig.json
Normal file
4
internal/eslint-config/tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vben/ts-config/node.json",
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
4
internal/stylelint-config/tsconfig.json
Normal file
4
internal/stylelint-config/tsconfig.json
Normal file
@@ -0,0 +1,4 @@
|
|||||||
|
{
|
||||||
|
"extends": "@vben/ts-config/node.json",
|
||||||
|
"include": ["src"]
|
||||||
|
}
|
27
internal/ts-config/base.json
Normal file
27
internal/ts-config/base.json
Normal file
@@ -0,0 +1,27 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"display": "Base",
|
||||||
|
"compilerOptions": {
|
||||||
|
"target": "ESNext",
|
||||||
|
"module": "ESNext",
|
||||||
|
"moduleResolution": "node",
|
||||||
|
"strict": true,
|
||||||
|
"declaration": true,
|
||||||
|
"noImplicitOverride": true,
|
||||||
|
"noUnusedLocals": true,
|
||||||
|
"esModuleInterop": true,
|
||||||
|
"useUnknownInCatchVariables": false,
|
||||||
|
"composite": false,
|
||||||
|
"declarationMap": false,
|
||||||
|
"forceConsistentCasingInFileNames": true,
|
||||||
|
"inlineSources": false,
|
||||||
|
"isolatedModules": true,
|
||||||
|
"skipLibCheck": true,
|
||||||
|
"noUnusedParameters": false,
|
||||||
|
"preserveWatchOutput": true,
|
||||||
|
"experimentalDecorators": true,
|
||||||
|
"resolveJsonModule": true,
|
||||||
|
"removeComments": true
|
||||||
|
},
|
||||||
|
"exclude": ["**/node_modules/**", "**/dist/**"]
|
||||||
|
}
|
12
internal/ts-config/node.json
Normal file
12
internal/ts-config/node.json
Normal file
@@ -0,0 +1,12 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"display": "Node Config",
|
||||||
|
"extends": "./base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"lib": ["ESNext"],
|
||||||
|
"types": ["vite/client"],
|
||||||
|
"noImplicitAny": true,
|
||||||
|
"sourceMap": true,
|
||||||
|
"noEmit": true
|
||||||
|
}
|
||||||
|
}
|
@@ -3,5 +3,10 @@
|
|||||||
"version": "1.0.0",
|
"version": "1.0.0",
|
||||||
"private": true,
|
"private": true,
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
|
"files": [
|
||||||
|
"base.json",
|
||||||
|
"node.json",
|
||||||
|
"vue.json"
|
||||||
|
],
|
||||||
"devDependencies": {}
|
"devDependencies": {}
|
||||||
}
|
}
|
||||||
|
10
internal/ts-config/vue.json
Normal file
10
internal/ts-config/vue.json
Normal file
@@ -0,0 +1,10 @@
|
|||||||
|
{
|
||||||
|
"$schema": "https://json.schemastore.org/tsconfig",
|
||||||
|
"display": "Vue Library",
|
||||||
|
"extends": "./base.json",
|
||||||
|
"compilerOptions": {
|
||||||
|
"jsx": "preserve",
|
||||||
|
"lib": ["ESNext", "DOM"],
|
||||||
|
"noImplicitAny": false
|
||||||
|
}
|
||||||
|
}
|
@@ -135,6 +135,7 @@
|
|||||||
"@types/sortablejs": "^1.15.1",
|
"@types/sortablejs": "^1.15.1",
|
||||||
"@vben/eslint-config": "workspace:*",
|
"@vben/eslint-config": "workspace:*",
|
||||||
"@vben/stylelint-config": "workspace:*",
|
"@vben/stylelint-config": "workspace:*",
|
||||||
|
"@vben/ts-config": "workspace:*",
|
||||||
"@vitejs/plugin-vue": "^4.1.0",
|
"@vitejs/plugin-vue": "^4.1.0",
|
||||||
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
"@vitejs/plugin-vue-jsx": "^3.0.1",
|
||||||
"@vue/compiler-sfc": "^3.2.47",
|
"@vue/compiler-sfc": "^3.2.47",
|
||||||
|
6690
pnpm-lock.yaml
generated
6690
pnpm-lock.yaml
generated
File diff suppressed because it is too large
Load Diff
@@ -1,27 +1,8 @@
|
|||||||
{
|
{
|
||||||
|
"extends": "@vben/ts-config/vue.json",
|
||||||
"compilerOptions": {
|
"compilerOptions": {
|
||||||
"target": "esnext",
|
"baseUrl": "./",
|
||||||
"module": "esnext",
|
|
||||||
"moduleResolution": "node",
|
|
||||||
"strict": true,
|
|
||||||
"noLib": false,
|
|
||||||
"forceConsistentCasingInFileNames": true,
|
|
||||||
"allowSyntheticDefaultImports": true,
|
|
||||||
"strictFunctionTypes": false,
|
|
||||||
"jsx": "preserve",
|
|
||||||
"baseUrl": ".",
|
|
||||||
"allowJs": true,
|
|
||||||
"sourceMap": true,
|
|
||||||
"esModuleInterop": true,
|
|
||||||
"resolveJsonModule": true,
|
|
||||||
"noUnusedLocals": true,
|
|
||||||
"noUnusedParameters": true,
|
|
||||||
"experimentalDecorators": true,
|
|
||||||
"lib": ["dom", "esnext"],
|
|
||||||
"noImplicitAny": false,
|
|
||||||
"skipLibCheck": true,
|
|
||||||
"types": ["vite/client"],
|
"types": ["vite/client"],
|
||||||
"removeComments": true,
|
|
||||||
"paths": {
|
"paths": {
|
||||||
"/@/*": ["src/*"],
|
"/@/*": ["src/*"],
|
||||||
"/#/*": ["types/*"]
|
"/#/*": ["types/*"]
|
||||||
|
1
types/global.d.ts
vendored
1
types/global.d.ts
vendored
@@ -63,7 +63,6 @@ declare global {
|
|||||||
VITE_GLOB_APP_TITLE: string;
|
VITE_GLOB_APP_TITLE: string;
|
||||||
VITE_GLOB_APP_SHORT_NAME: string;
|
VITE_GLOB_APP_SHORT_NAME: string;
|
||||||
VITE_USE_CDN: boolean;
|
VITE_USE_CDN: boolean;
|
||||||
VITE_DROP_CONSOLE: boolean;
|
|
||||||
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
|
VITE_BUILD_COMPRESS: 'gzip' | 'brotli' | 'none';
|
||||||
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
|
VITE_BUILD_COMPRESS_DELETE_ORIGIN_FILE: boolean;
|
||||||
}
|
}
|
||||||
|
@@ -27,7 +27,7 @@ export default async ({ command, mode }: ConfigEnv): Promise<UserConfig> => {
|
|||||||
// The boolean type read by loadEnv is a string. This function can be converted to boolean type
|
// The boolean type read by loadEnv is a string. This function can be converted to boolean type
|
||||||
const viteEnv = wrapperEnv(env);
|
const viteEnv = wrapperEnv(env);
|
||||||
|
|
||||||
const { VITE_PUBLIC_PATH, VITE_PROXY, VITE_DROP_CONSOLE } = viteEnv;
|
const { VITE_PUBLIC_PATH, VITE_PROXY } = viteEnv;
|
||||||
|
|
||||||
const isBuild = command === 'build';
|
const isBuild = command === 'build';
|
||||||
|
|
||||||
@@ -58,24 +58,12 @@ export default async ({ command, mode }: ConfigEnv): Promise<UserConfig> => {
|
|||||||
proxy: createProxy(VITE_PROXY),
|
proxy: createProxy(VITE_PROXY),
|
||||||
},
|
},
|
||||||
esbuild: {
|
esbuild: {
|
||||||
drop: VITE_DROP_CONSOLE ? ['console', 'debugger'] : [],
|
drop: ['console', 'debugger'],
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
target: 'es2015',
|
target: 'es2015',
|
||||||
cssTarget: 'chrome80',
|
cssTarget: 'chrome80',
|
||||||
outDir: OUTPUT_DIR,
|
outDir: OUTPUT_DIR,
|
||||||
// minify: 'terser',
|
|
||||||
/**
|
|
||||||
* 当 minify=“minify:'terser'” 解开注释
|
|
||||||
* Uncomment when minify="minify:'terser'"
|
|
||||||
*/
|
|
||||||
// terserOptions: {
|
|
||||||
// compress: {
|
|
||||||
// keep_infinity: true,
|
|
||||||
// drop_console: VITE_DROP_CONSOLE,
|
|
||||||
// },
|
|
||||||
// },
|
|
||||||
// Turning off brotliSize display can slightly reduce packaging time
|
|
||||||
reportCompressedSize: false,
|
reportCompressedSize: false,
|
||||||
chunkSizeWarningLimit: 2000,
|
chunkSizeWarningLimit: 2000,
|
||||||
},
|
},
|
||||||
|
Reference in New Issue
Block a user