From 2904a339fd8d5615a199b1ccc98f5ad677c5b269 Mon Sep 17 00:00:00 2001 From: dream2023 <1098626505@qq.com> Date: Wed, 7 Feb 2024 08:12:50 +0800 Subject: [PATCH] fix: build bug --- Dockerfile | 2 +- packages/core/app/client/.umirc.ts | 2 +- packages/core/build/src/buildClient.ts | 6 +++--- packages/core/build/src/buildPlugin.ts | 2 +- 4 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Dockerfile b/Dockerfile index 5d5fbf1a76..dcd0ce9792 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,7 +15,7 @@ RUN cd /tmp && \ NEWVERSION="$(cat lerna.json | jq '.version' | tr -d '"').$(date +'%Y%m%d%H%M%S')" \ && tmp=$(mktemp) \ && jq ".version = \"${NEWVERSION}\"" lerna.json > "$tmp" && mv "$tmp" lerna.json -RUN yarn install && yarn build --no-dts --sourcemap --development +RUN yarn install && yarn build --no-dts --development RUN git checkout -b release-$(date +'%Y%m%d%H%M%S') \ && yarn version:alpha -y diff --git a/packages/core/app/client/.umirc.ts b/packages/core/app/client/.umirc.ts index 575d173e73..95761bad16 100644 --- a/packages/core/app/client/.umirc.ts +++ b/packages/core/app/client/.umirc.ts @@ -18,7 +18,7 @@ indexGenerator.generate(); export default defineConfig({ title: 'Loading...', - devtool: process.env['sourcemap'] ? 'source-map' : false, + devtool: process.env.NODE_ENV === 'development' ? 'source-map' : false, favicons: ['/favicon/favicon.ico'], metas: [{ name: 'viewport', content: 'initial-scale=0.1' }], links: [ diff --git a/packages/core/build/src/buildClient.ts b/packages/core/build/src/buildClient.ts index ce0faa4f48..b8259bcdfc 100644 --- a/packages/core/build/src/buildClient.ts +++ b/packages/core/build/src/buildClient.ts @@ -39,7 +39,7 @@ export function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: boolean 'process.env.__E2E__': process.env.__E2E__ ? true : false, }, build: { - minify: false, + minify: process.env.NODE_ENV === 'production', outDir, cssCodeSplit: true, emptyOutDir: true, @@ -78,13 +78,13 @@ export async function buildLib( await viteBuild( userConfig.modifyViteConfig({ - mode: 'production', + mode: process.env.NODE_ENV || 'production', esbuild: { format: 'cjs', }, build: { outDir, - minify: false, + minify: process.env.NODE_ENV === 'production', sourcemap, lib: { entry: path.join(cwd, 'es/index.ts'), diff --git a/packages/core/build/src/buildPlugin.ts b/packages/core/build/src/buildPlugin.ts index 1676a50a38..601476ee0d 100644 --- a/packages/core/build/src/buildPlugin.ts +++ b/packages/core/build/src/buildPlugin.ts @@ -318,7 +318,7 @@ export async function buildPluginClient(cwd: string, userConfig: UserConfig, sou }, logLevel: 'warn', build: { - minify: sourcemap, + minify: process.env.NODE_ENV === 'production', outDir, cssCodeSplit: false, emptyOutDir: true,