-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
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 followup #4492
Comments
It will be deprecated when webpack5 comes out |
Regarding Docs: Values of |
I agree it looks verbose on newly created apps - we could document better the purpose of the runtime though. My understanding is that its better to have the runtime separated when you start to divide your app into multiple chunks (clients only need to download updated chunks when you deploy) |
I agree it’s good to separate it from the chunks but couldn’t it be always inlined in the HTML? |
It could be. AFAIK https://github.com/numical/script-ext-html-webpack-plugin provides an option to inline a certain script into HTML. |
Since runtime changes rarely, serving it with HTML each time would be a waste. Currently we can enable caching and only download it once, and this happens while the other chunks are being downloaded. This also slightly reduces initial HTML download time, so requests for other bundles start earlier. It can also be pushed with HTTP/2 if needed. |
A heads up about inlining scripts. This would be a breaking change for people who are using a strong Content Security Policy (CSP) that blocks all inline scripts. My preference would to be avoid inlining. |
Issues: #151 facebook/create-react-app#4492 Same as #117 with a test case. ----- fix #151 closes #117
There's a big performance regression that impacts Webpack 4, which is a concern for our Font Awesome icon packs and tree-shaking. See this issue against Webpack 4.11.0 depends upon Once CRA moves to Webpack 4, unless this perf regression has been fixed, devs using Font Awesome will be frustrated. And apparently, the only ways for them to resolve the problem will be to side-step that version of CRA: either downgrade to a CRA that uses Webpack 3, or eject from CRA and modify their Webpack configs. So I'm wincing, and hoping this gets resolved in Webpack 4's dependencies before CRA comes out with Webpack 4. |
Also I think the |
@marcofugaro which warnings are you referring to? thanks |
Hey @andriijas! The I tested the output of Also the parameter of the toJson() function here are not anymore necessary, here are the docs |
Yeah this one probably slipped through due to the skeleton app complying to all eslint rules. Sorry about that. Would you like to make a pr @marcofugaro |
Sure thing! I'll get my hands dirty when I have time in the next few days. Thanks @andriijas |
Ok, I investigated, the PR is the #4656, I noticed it doesn't happen with webpack v4.8 but with newer versions. |
I got CRA running with webpack 4 after an eject and two forks (InterpolateHTMLPlugin and WatchMissingNodeModulesPlugin). See here Maybe, it helps you. |
This assumption is not true, the runtime is the chunk that changes most often. The runtime contains a mapping from chunk id to chunk filename (which contains a hash of the content). That's why it always changes when any other chunk changed. That's usually the reason why you opt-in to a separate runtime chunk which is inlined. But this is not required to do. By default the runtime is put into the app chunk. So without separate runtime chunk your app chunk will change on any other chunk change. If you app chunk isn't too big this can be acceptable and better than a separate runtime chunk.
You should use the
You can pass arguments to the |
I get "Super expression must either be null or a function, not undefined" when I am building to production but not when I am running locally. That external library works fine with our current webpack 2 setup. So it feels like a problem webpack 4 maybe introduced. I have seen others solving that by setting "keep_fnames: true" in the uglify settings. But that didn't solve it for me when ejecting and trying that setting. |
@johdah We'd need a minimal reproducing example. |
Derived from facebook#4492 (comment)
Thanks to some titanic efforts from @andriijas, @bugzpodder and others we finally have Webpack 4 in master. Hopefully CI will pass.
Let's use this task to keep track of followup things to do? At the very least this looks suboptimal to me:
Why are we shipping a few hundred bytes of the runtime as a separate chunk instead of e.g. embedding it into the HTML? I suppose it would always be small so we could avoid the extra request.
I also think #4490 disabled scope hoisting (?) so we might want to keep track of what's necessary to get it enabled again.
Was there anything else?
The text was updated successfully, but these errors were encountered: