This commit is contained in:
dream2023 2024-02-06 21:23:58 +08:00
parent 35b4bfeab6
commit c4eff75175
5 changed files with 11 additions and 8 deletions

View File

@ -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
RUN yarn install && yarn build --no-dts --sourcemap --development
RUN git checkout -b release-$(date +'%Y%m%d%H%M%S') \
&& yarn version:alpha -y

View File

@ -18,6 +18,7 @@ indexGenerator.generate();
export default defineConfig({
title: 'Loading...',
devtool: process.env['sourcemap'] ? 'source-map' : false,
favicons: ['/favicon/favicon.ico'],
metas: [{ name: 'viewport', content: 'initial-scale=0.1' }],
links: [

View File

@ -20,7 +20,8 @@ import { Package } from '@lerna/package';
import { tarPlugin } from './tarPlugin'
export async function build(pkgs: string[]) {
process.env.NODE_ENV = 'production';
const isDev = process.argv.includes('--development');
process.env.NODE_ENV = isDev ? 'development' : 'production';
const packages = getPackages(pkgs);
if (packages.length === 0) {
@ -135,7 +136,8 @@ function runScript(args: string[], cwd: string, envs: Record<string, string> = {
env: {
...process.env,
...envs,
NODE_ENV: 'production',
sourcemap: process.argv.includes('--sourcemap') ? 'sourcemap' : undefined,
NODE_ENV: process.env.NODE_ENV || 'production',
},
});
}

View File

@ -32,9 +32,9 @@ export function buildEsm(cwd: string, userConfig: UserConfig, sourcemap: boolean
const outDir = path.resolve(cwd, 'es');
return viteBuild(
userConfig.modifyViteConfig({
mode: 'development',
mode: process.env.NODE_ENV || 'production',
define: {
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
'process.env.__TEST__': false,
'process.env.__E2E__': process.env.__E2E__ ? true : false,
},

View File

@ -310,15 +310,15 @@ export async function buildPluginClient(cwd: string, userConfig: UserConfig, sou
const outputFileName = 'index.js';
await viteBuild(userConfig.modifyViteConfig({
mode: 'development',
mode: process.env.NODE_ENV || 'production',
define: {
'process.env.NODE_ENV': JSON.stringify('development'),
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV || 'production'),
'process.env.__TEST__': false,
'process.env.__E2E__': process.env.__E2E__ ? true : false,
},
logLevel: 'warn',
build: {
minify: true,
minify: sourcemap,
outDir,
cssCodeSplit: false,
emptyOutDir: true,