Browse Source
build(webpack): remove redundant environment check
Webpack environment `mode` is defined directly in our environment
specific webpack config files. Due to this, we no longer need to
manually set `NODE_ENV` or check to ensure that it has been set.
See:
- https://webpack.js.org/concepts/mode/
renovate/lint-staged-8.x
Tom Kirkpatrick
7 years ago
No known key found for this signature in database
GPG Key ID: 72203A8EC5967EA8
5 changed files with
0 additions and
24 deletions
internals/scripts/CheckNodeEnv.js
webpack.config.main.prod.js
webpack.config.renderer.dev.dll.js
webpack.config.renderer.dev.js
webpack.config.renderer.prod.js
@ -1,12 +0,0 @@
// @flow
import chalk from 'chalk'
export default function CheckNodeEnv ( expectedEnv : string ) {
if ( ! expectedEnv ) {
throw new Error ( '"expectedEnv" not set' )
}
if ( process . env . NODE_ENV !== expectedEnv ) {
throw new Error ( chalk . whiteBright . bgRed . bold ( ` "process.env.NODE_ENV" must be " ${ expectedEnv } " to use this webpack config ` ) )
}
}
@ -6,9 +6,6 @@ import webpack from 'webpack'
import merge from 'webpack-merge'
import merge from 'webpack-merge'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import baseConfig from './webpack.config.base'
import baseConfig from './webpack.config.base'
import CheckNodeEnv from './internals/scripts/CheckNodeEnv'
CheckNodeEnv ( 'production' )
export default merge . smart ( baseConfig , {
export default merge . smart ( baseConfig , {
devtool : 'source-map' ,
devtool : 'source-map' ,
@ -7,9 +7,6 @@ import path from 'path'
import merge from 'webpack-merge'
import merge from 'webpack-merge'
import baseConfig from './webpack.config.base'
import baseConfig from './webpack.config.base'
import { dependencies } from './package.json'
import { dependencies } from './package.json'
import CheckNodeEnv from './internals/scripts/CheckNodeEnv'
CheckNodeEnv ( 'development' )
const dist = path . resolve ( process . cwd ( ) , 'dll' )
const dist = path . resolve ( process . cwd ( ) , 'dll' )
@ -14,11 +14,8 @@ import merge from 'webpack-merge'
import { spawn , execSync } from 'child_process'
import { spawn , execSync } from 'child_process'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import ExtractTextPlugin from 'extract-text-webpack-plugin'
import baseConfig from './webpack.config.base'
import baseConfig from './webpack.config.base'
import CheckNodeEnv from './internals/scripts/CheckNodeEnv'
import { mainLog } from './app/utils/log'
import { mainLog } from './app/utils/log'
CheckNodeEnv ( 'development' )
const port = process . env . PORT || 1212
const port = process . env . PORT || 1212
const publicPath = ` http://localhost: ${ port } /dist `
const publicPath = ` http://localhost: ${ port } /dist `
const dll = path . resolve ( process . cwd ( ) , 'dll' )
const dll = path . resolve ( process . cwd ( ) , 'dll' )
@ -7,9 +7,6 @@ import ExtractTextPlugin from 'extract-text-webpack-plugin'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer'
import merge from 'webpack-merge'
import merge from 'webpack-merge'
import baseConfig from './webpack.config.base'
import baseConfig from './webpack.config.base'
import CheckNodeEnv from './internals/scripts/CheckNodeEnv'
CheckNodeEnv ( 'production' )
export default merge . smart ( baseConfig , {
export default merge . smart ( baseConfig , {
devtool : 'source-map' ,
devtool : 'source-map' ,