From dbd2a08f7cad2636bc7cf26ee806f3e6dda39225 Mon Sep 17 00:00:00 2001 From: Chlod Alejandro Date: Tue, 28 May 2024 17:35:59 +0800 Subject: [PATCH] build: sense dev mode --- rollup.config.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/rollup.config.js b/rollup.config.js index 66fec3e5..6c8bc0d4 100644 --- a/rollup.config.js +++ b/rollup.config.js @@ -13,6 +13,8 @@ import * as fs from 'fs'; import * as path from 'path'; const production = process.env.NODE_ENV === 'production'; +const development = process.env.NODE_ENV === 'development' || + /dev(:|$)/.test( process.env.npm_lifecycle_event ); // UTILS @@ -46,6 +48,8 @@ function blockCommentIfy( text ) { * @return {string} A fully-decorated banner */ function loadBanner( ...bannerPath ) { + // development script, limited impact + // eslint-disable-next-line security/detect-non-literal-fs-filename return blockCommentIfy( fs.readFileSync( path.join( __dirname, ...bannerPath ) ) ); } @@ -91,7 +95,7 @@ function getPlugins() { !production && sourcemaps(), // Remove development-only code branches jscc( { - values: { _DEV: process.env.NODE_ENV === 'development' }, + values: { _DEV: development }, asloader: false } ), // Makes Common.js imports possible