Skip to content

Commit

Permalink
Add target:browserslist to webpack config to specify what ES6 feature…
Browse files Browse the repository at this point in the history
…s can be in runtime

Tells webpack whether it can use arrow functions or `let`/`const` in the generated runtime code.
Will start really work only after the fix in webpack/webpack#11754 is
released. Until then, arrow functions are incorrectly emitted even when they shouldn't.
  • Loading branch information
jsnajdr committed Dec 7, 2020
1 parent ba25168 commit 1454881
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 0 deletions.
1 change: 1 addition & 0 deletions packages/scripts/config/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ const cssLoaders = [

const config = {
mode,
target: 'browserslist',
entry: {
index: path.resolve( process.cwd(), 'src', 'index.js' ),
},
Expand Down
1 change: 1 addition & 0 deletions webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ module.exports = {
],
},
mode,
target: 'browserslist',
entry: gutenbergPackages.reduce( ( memo, packageName ) => {
const name = camelCaseDash( packageName );
memo[ name ] = `./packages/${ packageName }`;
Expand Down

0 comments on commit 1454881

Please sign in to comment.