Optimize: tsconfig - optimize alias config

This commit is contained in:
2024-03-15 15:29:33 +08:00
parent 715806b85d
commit de3d1831d0
7 changed files with 39 additions and 56 deletions

View File

@@ -1,9 +0,0 @@
root = true
[*]
charset = utf-8
indent_style = space
indent_size = 4
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true

View File

@@ -417,7 +417,6 @@ export const AntDesignResolver = (options: AntDesignResolverOptions = {}): Compo
sideEffects: getSideEffects(importName, options) sideEffects: getSideEffects(importName, options)
} }
} }
return undefined return undefined
} }
} }

View File

@@ -8,7 +8,7 @@ files:
- '!electron.vite.config.{js,ts,mjs,cjs}' - '!electron.vite.config.{js,ts,mjs,cjs}'
- '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}' - '!{.eslintignore,.eslintrc.cjs,.prettierignore,.prettierrc.yaml,dev-app-update.yml,CHANGELOG.md,README.md}'
- '!{.env,.env.*,.npmrc,pnpm-lock.yaml}' - '!{.env,.env.*,.npmrc,pnpm-lock.yaml}'
- '!{tsconfig.json,tsconfig.node.json,tsconfig.web.json}' - '!{tsconfig.json,tsconfig.node.json}'
asarUnpack: asarUnpack:
- resources/** - resources/**
win: win:

View File

@@ -1,4 +1,4 @@
import { resolve } from 'path' import { fileURLToPath, URL } from 'node:url'
import { defineConfig, externalizeDepsPlugin } from 'electron-vite' import { defineConfig, externalizeDepsPlugin } from 'electron-vite'
import react from '@vitejs/plugin-react' import react from '@vitejs/plugin-react'
import AutoImport from 'unplugin-auto-import/vite' import AutoImport from 'unplugin-auto-import/vite'
@@ -82,7 +82,7 @@ export default defineConfig({
], ],
resolve: { resolve: {
alias: { alias: {
'@': resolve('src/renderer/src') '@': fileURLToPath(new URL('./src/renderer/src', import.meta.url))
} }
} }
} }

View File

@@ -9,9 +9,7 @@
"dev": "electron-vite dev", "dev": "electron-vite dev",
"format": "prettier --write .", "format": "prettier --write .",
"lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix", "lint": "eslint . --ext .js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix",
"typecheck:node": "tsc --noEmit -p tsconfig.node.json --composite false", "typecheck": "tsc",
"typecheck:web": "tsc --noEmit -p tsconfig.web.json --composite false",
"typecheck": "npm run typecheck:node && npm run typecheck:web",
"start": "electron-vite preview", "start": "electron-vite preview",
"build": "electron-vite build && npm run typecheck", "build": "electron-vite build && npm run typecheck",
"postinstall": "electron-builder install-app-deps", "postinstall": "electron-builder install-app-deps",

View File

@@ -1,4 +1,37 @@
{ {
"files": [], "compilerOptions": {
"references": [{ "path": "./tsconfig.node.json" }, { "path": "./tsconfig.web.json" }] "target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"@/*": ["./src/renderer/src/*"]
},
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"types": ["unplugin-icons/types/react"]
},
"extends": "@electron-toolkit/tsconfig/tsconfig.web.json",
"include": [
"src/renderer/src/env.d.ts",
"src/renderer/src/**/*",
"src/renderer/src/**/*.tsx",
"src/preload/*.d.ts",
"src/renderer/auto-imports.d.ts"
],
"references": [{ "path": "./tsconfig.node.json" }]
} }

View File

@@ -1,38 +0,0 @@
{
"compilerOptions": {
"target": "ES2020",
"useDefineForClassFields": true,
"module": "ESNext",
"skipLibCheck": true,
"baseUrl": ".",
"paths": {
"@/*": [
"src/renderer/src/*"
]
},
/* Bundler mode */
"moduleResolution": "bundler",
"allowImportingTsExtensions": true,
"resolveJsonModule": true,
"isolatedModules": true,
"noEmit": true,
"jsx": "react-jsx",
/* Linting */
"strict": true,
"noUnusedLocals": true,
"noUnusedParameters": true,
"noFallthroughCasesInSwitch": true,
"types": ["unplugin-icons/types/react"]
},
"extends": "@electron-toolkit/tsconfig/tsconfig.web.json",
"include": [
"src/renderer/src/env.d.ts",
"src/renderer/src/**/*",
"src/renderer/src/**/*.tsx",
"src/preload/*.d.ts",
"src/renderer/auto-imports.d.ts"
]
}