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 #105

Closed
mhheise opened this issue Feb 19, 2018 · 15 comments
Closed

Webpack 4 support #105

mhheise opened this issue Feb 19, 2018 · 15 comments

Comments

@mhheise
Copy link
Contributor

mhheise commented Feb 19, 2018

I tried upgrading to webpack 4 but I am seeing this error:

TypeError: compiler.applyPlugins is not a function
    at (cwd)\node_modules\autodll-webpack-plugin\lib\plugin.js:142:20
    at <anonymous>

Looks like the error might be from this line:

https://github.com/asfktz/autodll-webpack-plugin/blob/master/src/plugin.js#L86

compiler.applyPlugins('autodll-stats-retrieved', stats, source);

I am not sure if you are working on this upgrade already (as webpack 4 made several breaking changes to the plugin system) -- but I would be happy to help.

@sudo-suhas
Copy link
Collaborator

Hey @mhheise, thanks for bringing this up! It would be very much welcome if you could make a PR with the changes required for webpack 4.

@emmenko
Copy link

emmenko commented Feb 21, 2018

I was trying to fix this issue as well, but I couldn't figure out yet what's the correct API to use here.

/cc @ooflorent @TheLarkInn Any hint on how to fix this? Also, is the "old" compiler.plugin API still working or does it need to be upgraded as well?
Thanks 🙏

@ooflorent
Copy link

ooflorent commented Feb 21, 2018

For webpack 4 compatibility, you need to use tapable hooks. First, you must add a custom hook to the compiler:

compiler.hooks.autodllStatsRetrieved = new SyncHooks(["stats", "source"]);

Then you can replace applyPlugins by:

compiler.hooks.autodllStatsRetrieved.call(stats, source);

If you want to keep webpack 3 compatibility, use feature detection:

if (compiler.hooks) {
  // webpack 4
} else {
  // webpack 3
}

@emmenko
Copy link

emmenko commented Feb 21, 2018

@ooflorent many thanks!

@sudo-suhas would you like to take care of this? Otherwise I'll try to open a PR.
It would be good to have webpack@4 support soon ;)

@mhheise
Copy link
Contributor Author

mhheise commented Feb 21, 2018

I have started work on my own fork -- I can push it up for review soon once tests are passing 😄

@emmenko
Copy link

emmenko commented Feb 21, 2018

@mhheise awesome! 🙌

@mhheise
Copy link
Contributor Author

mhheise commented Feb 23, 2018

@asfktz @sudo-suhas I have changes underway and will push a WIP PR shortly, but I am seeing this error when I am testing my changes with the examples directory:

Error: ENOENT: no such file or directory, open 'C:\Git\autodll-webpack-plugin\examples\recommended\node_modules\.cache\autodll-webpack-plugin\development_instance_0_1dc0c813842ea3b964c005e53b6b3ea3\vendor.manifest.json'

Any thoughts? I know that the file is not present on my machine, but I am not quite sure how to generate it so that an npm run build would succeed.

@asfktz
Copy link
Owner

asfktz commented Feb 23, 2018

Hi @mhheise!

First, thanks a lot for taking this 🙏

I'll take a look at it tomorrow and see what I can do to help (:

@asfktz
Copy link
Owner

asfktz commented Feb 27, 2018

Hi @mhheise, I've left I few notes in the PR

@marcofugaro
Copy link

marcofugaro commented Mar 20, 2018

Any update on this? html-webpack-plugin has been upgraded

EDIT: oh I see you guys are still working on it, good job!

@faceyspacey
Copy link
Contributor

faceyspacey commented Apr 5, 2018

I got html-webpack-plugin working. Please verify so it can get merged to the main package sooner:

https://www.npmjs.com/package/autodll-webpack-plugin-webpack-4
yarn add --dev autodll-webpack-plugin-webpack-4

see the PR: #106 (comment)

@simonjoom
Copy link

simonjoom commented May 27, 2018

👍

@imjeen
Copy link

imjeen commented May 30, 2018

@faceyspacey There is a little problem about the autodll-webpack-plugin-webpack-4 plugin.

npm i -S autodll-webpack-plugin-webpack-4 and build a webPack task with the plugin, it's error.

Maybe you can try with a new demo. (do not install autodll-webpack-plugin and use it )

@asfktz
Copy link
Owner

asfktz commented Jun 2, 2018

Hi everybody,
A new version released with webpack 4 support.

Thanks for @mhheise & @faceyspacey for making it happen ❤️

@mlippens
Copy link

Can't this be closed then? 👍

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

10 participants