Skip to content

Commit

Permalink
build: sense dev mode
Browse files Browse the repository at this point in the history
  • Loading branch information
ChlodAlejandro committed May 28, 2024
1 parent ca9058d commit dbd2a08
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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 ) ) );
}

Expand Down Expand Up @@ -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
Expand Down

0 comments on commit dbd2a08

Please sign in to comment.