johnagan / clean-webpack-plugin

A webpack plugin to remove your build folder(s) before building
MIT License
1.96k stars 134 forks source link

WIP: Clean on fail #181

Closed jneuendorf closed 1 year ago

jneuendorf commented 4 years ago

Fixes #179

jneuendorf commented 4 years ago

I need some help, because test.all fails (I had to disable husky in order to push anyway, create a PR and ask for help). 😕

For some reason the tests don't pass for webpack@next but I have no idea why/how my code changes can cause that. Could any of you please have a look and give me a hint? Thanks in advance 🙂

jneuendorf commented 4 years ago

@chrisblossom You seem to most active contributor. Could you please take a look? Maybe you find a hint that leads me into the right direction, quickly. Thanks in advance! 🙂

chrisblossom commented 4 years ago

It looks like webpack@next has some breaking changes that need to be addressed. I'll try and look into it as soon as I have some extra time.

alpadev commented 4 years ago

Cheers!

I had some little vue fun project running properly on webpack@4 and just recently updated it to use webpack@next and ran into a problem as well (in my case I used the default output options). So I spent some time to look into the situation and @chrisblossom you are indeed correct.

I have some experience with webpack but I'm far from being an expert. Though, from what I can tell the (two) tests are failing because 1) 'removes map files' - source-maps are now nested inside the toJson().assets array, within some related assets array so the currentAssets isn't properly set (landed in https://github.com/webpack/webpack/pull/11254) 2) 'webpack >= 4 only › works without config' - the plugin.apply method is now called before webpack fully initialized the options object passed to it, thus the plugin is getting disabled since options.output doesn't have a default value at this point. (It's a two step process landed in https://github.com/webpack/webpack/pull/10401)

https://github.com/johnagan/clean-webpack-plugin/issues/182 is also caused by those changes.

I think I can push some fix for this to make it work with webpack@next but I'm not sure about backwards compatibility (<4).