Uh oh!
There was an error while loading. Please reload this page.
Webpack 5 - #7929
Conversation
@andriijas Are you still working on this? I created my own branch and did a lot more work so if you want to cherry-pick from this into here or anywhere feel free. I'm able to run most of the e2e tests from The one test suite which isn't working very well is
Something really weird was that I had to amend this rule in order to avoid a validation error. And, perhaps related to this, but the default |
ScriptedAlchemy
commented
Mar 24, 2020
As one of the core maintainers of webpack. I’ll also be reviewing the progress here and will try to step in to support. Im about to finish next.js upgrade to WP5 |
ScriptedAlchemy
commented
Mar 24, 2020
Require ensure has changed. So to get the same feature set, you likely want to either tap it from the JavaScriptGenerator. - I do believe a requireEnsure hook still exists though. |
andriijas
commented
Mar 24, 2020
@sebinsua thanks for stepping in, I halted work on this by purpose - wanted webpack 5 to reach RC at least before continuing and for the obvious reason you mentioned, external plugins needs to be adressed with webpack 5 compability as well. Im now thinking we should create a feature branch here to make smaller PRs to - would you be open to help out? |
piotr-oles
commented
May 23, 2020
Hi!
|
raix
commented
Oct 10, 2020
Is this pull-request stale? |
andriijas
commented
Oct 10, 2020
Check comment here #9613 (comment) |
@andriijas To test things out I ejected on one or our applications and managed to do I'm not sure if it's helpful eg. to plan out smaller pull-requests for updating plugins etc. Some findings updating to webpack 5Loaders / Pluginspostcss-loader
terser-webpack-plugin
ForkTsCheckerWebpackPlugin newForkTsCheckerWebpackPlugin({async: isEnvDevelopment,// TODO: Add back resolvers for pnpTstypescript: {typescriptPath: resolve.sync('typescript',{basedir: paths.appNodeModules,}),context: paths.appPath,diagnosticOptions: {syntactic: true},mode: 'write-references'},logger: {infrastructure: "silent"},// The formatter is invoked directly in WebpackDevServerUtils during developmentformatter: isEnvProduction ? typescriptFormatter : undefined,})TODO: Add back pnp support optimize-css-assets-webpack-plugin (optional afaik)
In babel-preset-react-app
ManifestPlugin
webpack.IgnorePlugin
WorkboxWebpackPlugin.GenerateSW
References:
webpack 5 related:In Remove:
Add this fix to the top Fix filename in webpack.config.js previously it was In
In
In // request.descriptionFileRoot.indexOf('/node_modules/') !== -1 ||// request.descriptionFileRoot.indexOf('\\node_modules\\') !== -1 ||request.path.includes('/node_modules/')||request.path.includes('\\node_modules\\')||Looking at the request object the react-scripts buildUsing react-scripts startI've only just started looking at Disclaimer - I just ejected to test things out - currently only looking into getting it running - next would be to verify each change and its correctness |
andriijas
commented
Oct 11, 2020
@raix thx, ill might look into this during the week if i find some time :) |
ali-master
commented
Oct 14, 2020
Hi there, This MR should be updated because the Webpack v5 has been released 3 days ago. |
kagawagao
commented
Oct 15, 2020
Compiler |
andriijas
commented
Oct 31, 2020
Not since last update but I would like to pick it up soon, |
ScriptedAlchemy
commented
Oct 31, 2020
Once error formatting is done. I'll help on any remaining issues. I'm not not dealing with the formatted haha |
jasonwilliams
commented
Nov 1, 2020
@ScriptedAlchemy error formatting is easy, that snippet from @jimblue will solve it. If you wanted to make that PR and leave errorFormatting i can even PR that in. |
ScriptedAlchemy
commented
Nov 2, 2020
Where the most current branch, or do we need one which aggregates two branch change sets together? Just wrapping up storybooks webpack 5 upgrade, then can pull whatever branch is most current |
andriijas
commented
Nov 2, 2020
The fastest option is to create a new PR from scratch if you need to move quickly. |
ScriptedAlchemy
commented
Nov 2, 2020
I don't use CRA, so I'm just here to unstick any problems blocking the community on the nearest progressed branch. Will look around and see what's been proposed already |
@ScriptedAlchemy Let me know if you need help on making a pr - I do have a branch working locally with webpack 5 (when doing a manual QA), continued on the branch @sebinsua created on duplotech. (but it would be nice to break it up into smaller pieces or redo it) That said a strategy could also be to make small pull-requests to master upgrading the different plugins.
More findings in #7929 (comment) (I have to move really fast so did actually build a CRA compatible build from scratch with federated module support written in TypeScript - but would prefer to use CRA if possible, I'm hoping to move back at some point - will help out if needed) Kind regards Morten |
andriijas
commented
Nov 2, 2020
@raix Thanks for the compilation. I agree it would be beneficial to try to cut the upgrade to as small chunks as possible. Getting support for federated modules should be done separately as it's a new feature however it will be useful for large multi team companies who use CRA for microfrontend dev. |
jasonwilliams
commented
Nov 2, 2020
Agree with both small pull requests and doing module federation separately. I wouldn’t focus on module federation right now as no one is waiting on that and can be done at a later date. We don’t want to add even more scope to this. @raix can I suggest we move your list to an issue? Then we can keep the list as PRs get merged. |
raix
commented
Nov 2, 2020
@jasonwilliams@andriijas I've created an issue containing an initial overview of what needs to be tackled to get Webpack 5 in CRA - #9994 let me know what you think |
jasonwilliams
commented
Nov 2, 2020
Looks good to me, I reckon we can close this PR and move conversation there |
Refs #1703 * Inline loaders and ! prefixes should not be used as they are non-standard. They may be used by loader generated code. https://webpack.js.org/configuration/module/#ruleenforce * Adds support for both Webpack 4 and 5 in StyleguidistOptionsPlugin * Updates dependencies in Webpack example (easier to test against) * Because automatic polyfilling is switched off in 5, assert was brought in as a dependency (it's used by Doctrine, see below) ## Upstream issues Both issues below are tied to react/create-react-app#7929: * Process is not defined - The page still builds but this error will show in the console. I can't seem to polyfill this if anyone else can that would be great, then I think we're done. * TypeError: message.split is not a function - you may not get this error, but if you do it's related to react/create-react-app#7929. The quick fix is to go into node_modules/react-dev-utils/formatWebpackMessages.js:19 and add the code from react/create-react-app#7929 (comment) ## Not needed for this but nice to have. Doctrine should be replaced with another JSDoc parser. Doctrine is end of life and no longer supported. It causes problems with Webpack 5 because it pulls in assert which WP5 does not polyfill. For now, we can fix it by adding those polyfills (assert) but a more stable solution should be found. The issue raised: #1708
raix
commented
Dec 4, 2020
just a minor update: |
andriijas
commented
Dec 4, 2020
@raix ive seen it, i will help review and testing. Good work! |
@andriijas thank you! I'll keep the status updated and in general help to make progress But if possible it might make sense to prioritize merging #10091 (and #10177) ? as it will fix part of the test suite - would be really helpful, I normally fix the test suite locally and run tests but it's a slow process |
cristovaoth
commented
Jan 5, 2021
We are trying to achieve the same, i.e., eject latest cra, and upgrade to webpack@5. We followed all the steps you outlined above, and also under #9994, but currently not able to make it work. Perhaps you could push the aforementioned local branch where you made this work @raix ? That would be super helpful Kind regards |
raix
commented
Jan 5, 2021
@CristovaoHonorato I dont have that work locally anymore (I clean up stale work, was a POC, result of that week was custom wp/cli and the key points posted here) - the pull-requests open in the CRA project should bring remaining changes down to the webpack config (The branch @sebinsua created might also give clues to changes needed in the config) |
Needed for future Docker compatibility. Manually applied many of the PRs from react/create-react-app#9994 and react/create-react-app#7929 (including comments)
Needed for future Docker compatibility. Manually applied many of the PRs from react/create-react-app#9994 and react/create-react-app#7929 (including comments)
Needed for future Docker compatibility. Manually applied many of the PRs from react/create-react-app#9994 and react/create-react-app#7929 (including comments)
D4nte
commented
Aug 17, 2021
Is this included in 5.0.0-next.31? |
This draft PR aims to integrate webpack 5 into
create-react-app.Integration is currently in early stages and not ready to for community testing yet as there are a couple of tasks to resolve before we have first successful builds. Thank you for your patience!
Internal work
modeExternal work