Skip to content

Commit

Permalink
Add inline comments for global variables used with Webpack
Browse files Browse the repository at this point in the history
  • Loading branch information
gziolo committed Oct 11, 2018
1 parent 61bceee commit 342b1fa
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ const config = {
to: `./build/${ packageName }/`,
flatten: true,
transform: ( content ) => {
if ( isProduction ) {
if ( config.mode === 'production' ) {
return postcss( [
require( 'cssnano' )( {
preset: 'default',
Expand All @@ -230,7 +230,11 @@ const config = {
},
} ) )
),
// GUTENBERG_BUNDLE_ANALYZER global variable enables utility that represents bundle content
// as convenient interactive zoomable treemap.
process.env.GUTENBERG_BUNDLE_ANALYZER && new BundleAnalyzerPlugin(),
// GUTENBERG_LIVE_RELOAD_PORT global variable changes port on which live reload works
// when running watch mode.
! isProduction && new LiveReloadPlugin( { port: process.env.GUTENBERG_LIVE_RELOAD_PORT || 35729 } ),
].filter( Boolean ),
stats: {
Expand All @@ -239,6 +243,8 @@ const config = {
};

if ( ! isProduction ) {
// GUTENBERG_DEVTOOL global variable controls how source maps are generated.
// See: https://webpack.js.org/configuration/devtool/#devtool.
config.devtool = process.env.GUTENBERG_DEVTOOL || 'source-map';
}

Expand Down

0 comments on commit 342b1fa

Please sign in to comment.