Skip to content

Commit

Permalink
Scripts: Add missing fallback for target in webpack 5 config (#34112)
Browse files Browse the repository at this point in the history
* Scripts: Add missing fallback for target in webpack 5 config

* Add changelog entry
  • Loading branch information
gziolo committed Aug 18, 2021
1 parent fe2de42 commit f2797ad
Show file tree
Hide file tree
Showing 5 changed files with 16 additions and 1 deletion.
2 changes: 2 additions & 0 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions packages/scripts/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@
- The bundled `@svgr/webpack` dependency has been updated from requiring `^5.2.0` to requiring `^5.5.0` ([#33818](https://github.com/WordPress/gutenberg/pull/33818)).
- The bundled `webpack-bundle-analyzer` dependency has been updated from requiring `^4.2.0` to requiring `^4.4.2` ([#33818](https://github.com/WordPress/gutenberg/pull/33818)).

### Bug Fixes

- Add missing fallback for target in webpack 5 config ([#34112](https://github.com/WordPress/gutenberg/pull/34112)),

## 17.1.0 (2021-07-29)

### Enhancements
Expand Down
1 change: 1 addition & 0 deletions packages/scripts/config/.browserslistrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
extends @wordpress/browserslist-config
8 changes: 7 additions & 1 deletion packages/scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ const LiveReloadPlugin = require( 'webpack-livereload-plugin' );
const MiniCSSExtractPlugin = require( 'mini-css-extract-plugin' );
const TerserPlugin = require( 'terser-webpack-plugin' );
const { CleanWebpackPlugin } = require( 'clean-webpack-plugin' );
const browserslist = require( 'browserslist' );
const path = require( 'path' );

/**
Expand All @@ -18,13 +19,18 @@ const postcssPlugins = require( '@wordpress/postcss-plugins-preset' );
* Internal dependencies
*/
const {
fromConfigRoot,
hasBabelConfig,
hasCssnanoConfig,
hasPostCSSConfig,
} = require( '../utils' );

const isProduction = process.env.NODE_ENV === 'production';
const mode = isProduction ? 'production' : 'development';
let target = 'browserslist';
if ( ! browserslist.findConfig( '.' ) ) {
target += ':' + fromConfigRoot( '.browserslistrc' );
}

const cssLoaders = [
{
Expand Down Expand Up @@ -81,7 +87,7 @@ const getLiveReloadPort = ( inputPort ) => {

const config = {
mode,
target: 'browserslist',
target,
entry: {
index: path.resolve( process.cwd(), 'src', 'index.js' ),
},
Expand Down
2 changes: 2 additions & 0 deletions packages/scripts/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
"dependencies": {
"@svgr/webpack": "^5.5.0",
"@wordpress/babel-preset-default": "file:../babel-preset-default",
"@wordpress/browserslist-config": "file:../browserslist-config",
"@wordpress/dependency-extraction-webpack-plugin": "file:../dependency-extraction-webpack-plugin",
"@wordpress/eslint-plugin": "file:../eslint-plugin",
"@wordpress/jest-preset-default": "file:../jest-preset-default",
Expand All @@ -43,6 +44,7 @@
"@wordpress/stylelint-config": "file:../stylelint-config",
"babel-jest": "^26.6.3",
"babel-loader": "^8.2.2",
"browserslist": "^4.16.6",
"chalk": "^4.0.0",
"check-node-version": "^4.1.0",
"clean-webpack-plugin": "^3.0.0",
Expand Down

0 comments on commit f2797ad

Please sign in to comment.