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

V4 #165

Open
wants to merge 5 commits into
base: master
Choose a base branch
from
Open

V4 #165

wants to merge 5 commits into from

Conversation

chrisblossom
Copy link
Collaborator

This is a major version bump because the @types/webpack have been removed, and cleanOnceBeforeBuildPatterns uses the compile hook afterCompile instead of emit so plugin order should no longer matter.

Also enables async removal of files for webpack 4+.

Miscellaneous package maintenance such as package upgrades done as well.

Closes: #127, #150, #155, #163

@chrisblossom
Copy link
Collaborator Author

facebook/docusaurus#1839: We want v2 of clean-webpack-plugin that use webpack compile hook, unlike its v3 that uses emit hook. Using upstream clean-webpack-plugin will break our SSR setup and fail our build

@endiliey does using after-compile in this PR solve the issue above?

Repository owner deleted a comment from codecov-io Oct 16, 2019
@endiliey
Copy link
Contributor

It didnt work for ours because our setup is slightly complicated. We have a client and server compilation running

@chrisblossom
Copy link
Collaborator Author

@endiliey but the compile lifecycle works for your setup? What can we do here to fix this in the library. Maybe add an option for custom lifecycle clean patterns?

@endiliey
Copy link
Contributor

endiliey commented Oct 17, 2019

yes it works on our setup. I am not sure why v3 used emit hook when v2 is compile since I havent really followed this repository much except for watching releases.

I am not sure whats the best solution but anyway I think its ok if cleanwebpackplugin cant satisfy all use case. We are quite happy staying in v2 modified version for now.

@chrisblossom
Copy link
Collaborator Author

@endiliey I definitely agree this / any library doesn't need to satisfy all use cases, but this one can easily adapt to yours/others with similar issues. But that being said, do you know why after-compile won't work for you just as well as compile? FYI, currently v3 uses emit.

@endiliey
Copy link
Contributor

endiliey commented Oct 18, 2019

So we have one client config and another server config. It will be run in one instance of webpack. The clean webpack is ran in the client config while the server config has something called WaitPlugin (using Make hooks) that waits for client manifest file to complete (client manifest is ran on emit)

Since server compilation is usually faster, theres a high chance the wait plugin on server already detect that client manifest has been built (from previous build) but later on the client clean webpack plugin deleted it, hence causing an error.

I think this is too specific for our use case. Technically we can just run both config sequentially but we dont want that for now.

Edit & update: it's not working for us because one of our plugin is using afterCompile hook as well to emit a file, and it got deleted with clean webpack ⭕️

@MirKml
Copy link

MirKml commented Mar 15, 2021

Any update on this?
It seems that @types/wepback as dependency is problematic for Typescript 4.2+. There are many errors like

node_modules/@types/webpack/index.d.ts(1260,21): error TS2707: Generic type 'SyncWaterfallHook<T, AdditionalOptions>' requires between 1 and 2 type arguments.
node_modules/@types/webpack/index.d.ts(1261,22): error TS2707: Generic type 'SyncWaterfallHook<T, AdditionalOptions>' requires between 1 and 2 type arguments.
node_modules/@types/webpack/index.d.ts(1262,19): error TS2707: Generic type 'SyncHook<T, R, AdditionalOptions>' requires between 1 and 3 type arguments.
node_modules/@types/webpack/index.d.ts(1358,29): error TS2707: Generic type 'AsyncSeriesHook<T, AdditionalOptions>' requires between 1 and 2 type arguments.
node_modules/@types/webpack/index.d.ts(1374,25): error TS2707: Generic type 'SyncHook<T, R, AdditionalOptions>' requires between 1 and 3 type arguments.

remove @types/wepback from dependencies please

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

Successfully merging this pull request may close these issues.

Move @types/webpack to dependencies rather than devDependencies
3 participants