Skip to content
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 support #83

Closed
wshamim opened this issue Mar 5, 2018 · 11 comments
Closed

Webpack 4 support #83

wshamim opened this issue Mar 5, 2018 · 11 comments

Comments

@wshamim
Copy link

wshamim commented Mar 5, 2018

Hi, I am thinking to upgrade to Webpack 4.

Just want to ask if it is in your plans to add its support?

Cheers

@rxaviers
Copy link
Owner

rxaviers commented Mar 5, 2018

I'd be open to include any necessary upgrades

@marvinhagemeister
Copy link

Together with @jzaefferer we made a stab at trying to port it to webpack4. There are a few api changes here and there for plugins, but we couldn't get the cldr data to be bundled correctly. We gave up after an hour or so of trying, but this seems to be doable for someone with more initimate knowledge of the internals of globalizejs

@mgvparas
Copy link

any updates on this?

@rxaviers
Copy link
Owner

Globalize is distributed using UMD and webpack attempts to use its AMD module exports instead of CJS. This plugin forces webpack to use the expected CJS. In webpack 4, this stopped working. We need to investigate why and fix it.

@rxaviers
Copy link
Owner

Webpack 4 had a breaking change for plugins/loaders https://github.com/webpack/webpack/releases/tag/v4.0.0

@rxaviers
Copy link
Owner

Yeap, it requires significant rewrite (and major bump)...

I have updated a dependency to support webpack 4 rxaviers/skip-amd-webpack-plugin#7

@jzaefferer
Copy link
Contributor

Sounds like the updated skip-amd-webpack-plugin is only a small part of that?

As for the v4 plugin API, this seems to be up-to-date and more helpful than the changelog: https://webpack.js.org/api/plugins/

And there's a migration guide here, for 'plugin and loader authors': https://medium.com/webpack/webpack-4-migration-guide-for-plugins-loaders-20a79b927202

I have no clue how the plugin currently works.. I guess I could start with upgrading skip-amd-webpack-plugin to 1.0.0 and the webpack peer/dev dependency to 4.x.x, run npm test and see what breaks? Seems dangerous to go alone...

PS: As far as I can tell, this is the only blocker for upgrading to webpack 4, which promises much improve performance.

@jzaefferer
Copy link
Contributor

Looks like the first hurdle is to migrate from CommonChunksPlugin to optimization.splitChunks: #87

PS: Maybe https://gist.github.com/gricard/e8057f7de1029f9036a990af95c62ba8 and https://webpack.js.org/plugins/split-chunks-plugin/ can help, too.

@rxaviers
Copy link
Owner

rxaviers commented May 15, 2018

Jörn, I couldn't dig into it, but your direction seems correct to me.

FWIW, I often find very helpful to look into webpack source code in addition to reading their documentation.

My tip is to compare webpack source code v3...v4 to find out what changes are required. For example, let's take the compiler.plugin("this-compilation", (compilation) => { code. It changed from this to that.

@superheri
Copy link

Anything new on this? It's actually blocking me to upgrade to webpack 4 and all my other configs works fine.

@ngoov
Copy link

ngoov commented Aug 10, 2018

+1 webpack 4 is the standard now

gseguin pushed a commit to gseguin/globalize-webpack-plugin that referenced this issue Aug 16, 2018
rxaviers pushed a commit that referenced this issue Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants