mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2026-02-06 13:05:09 +00:00
Add dev build script and improve Vite config
Introduces a 'build:shell:dev' script for development builds and updates napcat-shell's Vite config to conditionally enable source maps in development mode. This enhances build flexibility for development and production environments.
This commit is contained in:
@@ -6,6 +6,7 @@
|
||||
"main": "index.ts",
|
||||
"scripts": {
|
||||
"build": "vite build",
|
||||
"build:dev": "vite build --mode development",
|
||||
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json"
|
||||
},
|
||||
"exports": {
|
||||
|
||||
@@ -34,7 +34,7 @@ const ShellBaseConfigPlugin: PluginOption[] = [
|
||||
nodeResolve(),
|
||||
napcatVersion(),
|
||||
];
|
||||
const ShellBaseConfig = () =>
|
||||
const ShellBaseConfig = (source_map: boolean = false) =>
|
||||
defineConfig({
|
||||
resolve: {
|
||||
conditions: ['node', 'default'],
|
||||
@@ -48,7 +48,7 @@ const ShellBaseConfig = () =>
|
||||
},
|
||||
},
|
||||
build: {
|
||||
sourcemap: true,
|
||||
sourcemap: source_map,
|
||||
target: 'esnext',
|
||||
minify: false,
|
||||
lib: {
|
||||
@@ -65,7 +65,13 @@ const ShellBaseConfig = () =>
|
||||
},
|
||||
},
|
||||
});
|
||||
export default defineConfig((): UserConfig => {
|
||||
export default defineConfig(({ mode }): UserConfig => {
|
||||
if (mode === 'development') {
|
||||
return {
|
||||
...ShellBaseConfig(true),
|
||||
plugins: [...ShellBaseConfigPlugin],
|
||||
};
|
||||
}
|
||||
return {
|
||||
...ShellBaseConfig(),
|
||||
plugins: [...ShellBaseConfigPlugin],
|
||||
|
||||
Reference in New Issue
Block a user