johnagan / clean-webpack-plugin

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

The typings issue while upgrade to webpack@5.1.3 #188

Open tianyingchun opened 3 years ago

tianyingchun commented 3 years ago

after we upgrade to webpack@5 it will throw typings errors

// `clean-webpack-plugin.d.ts`
import { Compiler, Stats, Compilation as compilnType } from 'webpack';
declare type Compilation = compilationType.Compilation;
export interface Options {
....
}

Maybe it should changed to

import { Compiler, Stats, Compilation } from 'webpack';
export interface Options {
....
}
joeldenning commented 3 years ago

Is there any known workaround for this? For now I am removing clean-webpack-plugin from shared webpack configs in create-single-spa, since it throws typescript errors with webpack 5.

strootje commented 3 years ago

@johnagan I am trying to update this package to webpack v5. But would like some help. See my branch: https://github.com/johnagan/clean-webpack-plugin/compare/master...strootje:update-webpack-v5

It seems that the .map files aren't being removed. which makes me assume that they've been removed from the assets map. Got any clue's?

tianyingchun commented 3 years ago

what progress about this issue

alexander-akait commented 3 years ago

You don't need this plugin with webpack v5, please look at output.clean: true option

shanedg commented 3 years ago

@alexander-akait thanks for pointing this out! At the moment, Webpack 5 guides still recommend this plugin for cleaning the dist/ folder and a clean option is missing under output configuration.

FYI there's a new, internal CleanPlugin

Here's the relevant bit in the Webpack 5 src: https://github.com/webpack/webpack/blob/master/lib/WebpackOptionsApply.js#L181-L186

johnagan commented 3 years ago

FYI there's a new, internal CleanPlugin

That's great! I would be happy to deprecate this one since I don't have time to spend on it anymore.

alexander-akait commented 3 years ago

@shanedg docs was updated https://webpack.js.org/guides/output-management/#cleaning-up-the-dist-folder