-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Webpack 4: Try migrating to WebPack 4 #5267
Conversation
webpack.config.js
Outdated
@@ -143,7 +144,7 @@ const config = { | |||
}, {} ) | |||
), | |||
output: { | |||
filename: '[basename]/build/index.js', | |||
filename: '[name]/build/index.js', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I had to update this, basename
was not working. I wonder if it's because of CustomTemplatedPathPlugin
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Possible that the plugin needs to be updated to support the new version of Webpack.
Related: #5687, WordPress/packages#93 |
package.json
Outdated
@@ -77,7 +77,7 @@ | |||
"eslint-plugin-jsx-a11y": "6.0.2", | |||
"eslint-plugin-react": "7.5.1", | |||
"expose-loader": "0.7.3", | |||
"extract-text-webpack-plugin": "3.0.0", | |||
"extract-text-webpack-plugin": "4.0.0-alpha.0", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://github.com/webpack-contrib/extract-text-webpack-plugin/releases/tag/v4.0.0-beta.0 - beta is out, but still not a stable one. We probably should proceed anyway.
webpack.config.js
Outdated
@@ -127,6 +126,8 @@ class CustomTemplatedPathPlugin { | |||
} | |||
|
|||
const config = { | |||
mode: process.env.NODE_ENV === 'production' ? 'production' : 'development', |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Interesting
I would say, let's finish work on |
Relevant: webpack-contrib/extract-text-webpack-plugin#749 Appears there may be an official deprecation of |
Yes, they officially recommend this new plugin for Webpack >= 4.0.0. We should update this PR. |
Merged #5687 into this branch. I'll rebase and look at bringing in |
Rebased to resolve conflicts. I tried pulling in I'd also tinkered with some additional settings for Lodash, since only the |
I was waiting on the previous release to move forward on this one. Rebased to resolve conflicts, verified development and production builds, and incremental rebuild (which is very fast by the way!). Suggestions for future pull requests:
|
break; | ||
|
||
default: | ||
config.devtool = 'source-map'; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Did we intend to remove the devtool
here? Currently investigating issues with sourcemaps, doesn't seem like this should have been impacted by the upgrade (aside from accommodating within new pattern for assigning environment).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I originally removed all "dev" related setup because while reading about WebPack, I thought the idea was that the "mode" was taking care of all these things automatically. Not the source map I guess
This is not ready yet because
extract-text-webpack-plugin
is not available yet as a stable release for webpack 4.I'm seeing some warnings in the console of Gutenberg related to source maps. Also not seeing the big performance improvements everyone is talking about.