johnagan / clean-webpack-plugin

A webpack plugin to remove your build folder(s) before building

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

The typings issue while upgrade to webpack@5.1.3

tianyingchun opened this issue · comments

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 {
....
}

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.

@johnagan I am trying to update this package to webpack v5. But would like some help. See my branch: 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?

what progress about this issue

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

@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

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.