mirror of
https://github.com/NapNeko/NapCatQQ.git
synced 2025-12-19 21:20:07 +08:00
Add dev build script and improve Vite config
Introduces a 'build🐚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:
parent
66d02eeb6a
commit
a2a73ce2dd
@ -5,6 +5,7 @@
|
|||||||
"version": "0.0.1",
|
"version": "0.0.1",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build:shell": "pnpm --filter napcat-shell run build || exit 1",
|
"build:shell": "pnpm --filter napcat-shell run build || exit 1",
|
||||||
|
"build:shell:dev": "pnpm --filter napcat-shell run build:dev || exit 1",
|
||||||
"build:framework": "pnpm --filter napcat-framework run build || exit 1",
|
"build:framework": "pnpm --filter napcat-framework run build || exit 1",
|
||||||
"build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1",
|
"build:webui": "pnpm --filter napcat-webui-frontend run build || exit 1",
|
||||||
"dev:shell": "pnpm --filter napcat-develop run dev || exit 1",
|
"dev:shell": "pnpm --filter napcat-develop run dev || exit 1",
|
||||||
|
|||||||
@ -6,6 +6,7 @@
|
|||||||
"main": "index.ts",
|
"main": "index.ts",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"build": "vite build",
|
"build": "vite build",
|
||||||
|
"build:dev": "vite build --mode development",
|
||||||
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json"
|
"typecheck": "tsc --noEmit --skipLibCheck -p tsconfig.json"
|
||||||
},
|
},
|
||||||
"exports": {
|
"exports": {
|
||||||
|
|||||||
@ -34,7 +34,7 @@ const ShellBaseConfigPlugin: PluginOption[] = [
|
|||||||
nodeResolve(),
|
nodeResolve(),
|
||||||
napcatVersion(),
|
napcatVersion(),
|
||||||
];
|
];
|
||||||
const ShellBaseConfig = () =>
|
const ShellBaseConfig = (source_map: boolean = false) =>
|
||||||
defineConfig({
|
defineConfig({
|
||||||
resolve: {
|
resolve: {
|
||||||
conditions: ['node', 'default'],
|
conditions: ['node', 'default'],
|
||||||
@ -48,7 +48,7 @@ const ShellBaseConfig = () =>
|
|||||||
},
|
},
|
||||||
},
|
},
|
||||||
build: {
|
build: {
|
||||||
sourcemap: true,
|
sourcemap: source_map,
|
||||||
target: 'esnext',
|
target: 'esnext',
|
||||||
minify: false,
|
minify: false,
|
||||||
lib: {
|
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 {
|
return {
|
||||||
...ShellBaseConfig(),
|
...ShellBaseConfig(),
|
||||||
plugins: [...ShellBaseConfigPlugin],
|
plugins: [...ShellBaseConfigPlugin],
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user