Skip to content

Commit 3d4fb16

Browse files
committedNov 1, 2023
chore: modify package.json and rollup.config
1 parent 7d31ac3 commit 3d4fb16

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed
 

‎package.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"commit-amend-build": "scripts/commit-amend-build.sh",
88
"prebuild": "rimraf dist/**",
99
"dev": "cross-env NODE_ENV=development BABEL_ENV=rollup rollup -w -c -o dist/purify.js",
10-
"build": "cross-env NODE_ENV=production rollup -c",
10+
"build": "rollup -c",
1111
"build:umd": "rollup -c -f umd -o dist/purify.js",
1212
"build:umd:min": "rollup -c -f umd -o dist/purify.min.js -p terser",
1313
"build:es": "rollup -c -f es -o dist/purify.es.js",

‎rollup.config.js

+2-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const { terser } = require('rollup-plugin-terser');
66
const pkg = require('./package.json');
77

88
const env = process.env.NODE_ENV;
9-
const isProd = env === 'production';
9+
const event = process.env.npm_lifecycle_event; // build, build:umd, ...
1010
const version = process.env.npm_package_version;
1111
const license = fs
1212
.readFileSync('./src/license_header', 'utf8')
@@ -32,7 +32,7 @@ const config = {
3232
...commonOutputConfig,
3333
file: pkg.production,
3434
format: 'umd',
35-
plugins: isProd ? [terser()] : [],
35+
plugins: event === 'build' ? [terser()] : [],
3636
},
3737
{
3838
...commonOutputConfig,

0 commit comments

Comments
 (0)
Please sign in to comment.