mirror of
https://github.com/vbenjs/vue-vben-admin.git
synced 2025-01-24 10:33:50 +08:00
feat: esbuild增加不同开发模式下对cnosole debugger的处理 (#2907)
This commit is contained in:
parent
c6e135195a
commit
4e3e721650
@ -89,7 +89,7 @@ function defineApplicationConfig(defineOptions: DefineOptions = {}) {
|
||||
plugins,
|
||||
};
|
||||
|
||||
const mergedConfig = mergeConfig(commonConfig, applicationConfig);
|
||||
const mergedConfig = mergeConfig(commonConfig(mode), applicationConfig);
|
||||
|
||||
return mergeConfig(mergedConfig, overrides);
|
||||
});
|
||||
|
@ -2,12 +2,12 @@ import { presetTypography, presetUno } from 'unocss';
|
||||
import UnoCSS from 'unocss/vite';
|
||||
import { type UserConfig } from 'vite';
|
||||
|
||||
const commonConfig: UserConfig = {
|
||||
const commonConfig: (mode: string) => UserConfig = (mode) => ({
|
||||
server: {
|
||||
host: true,
|
||||
},
|
||||
esbuild: {
|
||||
drop: ['debugger'],
|
||||
drop: mode === 'procution' ? ['console', 'debugger'] : [],
|
||||
},
|
||||
build: {
|
||||
reportCompressedSize: false,
|
||||
@ -22,6 +22,6 @@ const commonConfig: UserConfig = {
|
||||
presets: [presetUno(), presetTypography()],
|
||||
}),
|
||||
],
|
||||
};
|
||||
});
|
||||
|
||||
export { commonConfig };
|
||||
|
@ -14,7 +14,7 @@ interface DefineOptions {
|
||||
function definePackageConfig(defineOptions: DefineOptions = {}) {
|
||||
const { overrides = {} } = defineOptions;
|
||||
const root = process.cwd();
|
||||
return defineConfig(async () => {
|
||||
return defineConfig(async ({ mode }) => {
|
||||
const { dependencies = {}, peerDependencies = {} } = await readPackageJSON(root);
|
||||
const packageConfig: UserConfig = {
|
||||
build: {
|
||||
@ -33,7 +33,7 @@ function definePackageConfig(defineOptions: DefineOptions = {}) {
|
||||
}),
|
||||
],
|
||||
};
|
||||
const mergedConfig = mergeConfig(commonConfig, packageConfig);
|
||||
const mergedConfig = mergeConfig(commonConfig(mode), packageConfig);
|
||||
|
||||
return mergeConfig(mergedConfig, overrides);
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user