Git Product home page Git Product logo

Comments (10)

alexreg avatar alexreg commented on June 1, 2024 10

This is a problem for me too! I'm using it with webpack-dev-server instead, though.

from clean-webpack-plugin.

jackypan1989 avatar jackypan1989 commented on June 1, 2024 3

https://github.com/jackypan1989/del-webpack-plugin

from clean-webpack-plugin.

ChrisRAoW avatar ChrisRAoW commented on June 1, 2024 2

I submitted a pull request last week which is already merged. You can now set "beforeEmit" to true in the options and it will clean the dist folder just before the files are emitted to the output dir

from clean-webpack-plugin.

fleurdulicoder avatar fleurdulicoder commented on June 1, 2024 1

So, I am using "beforeEmit" set to true.

plugins: [ new CleanWebpackPlugin(['*'], { root: path.join(__dirname, 'dist/'), beforeEmit: true, }), ... ]

That creates a totally new issue in itself. When I load webpack server, apparently, this plugin just before I load my web page, deletes my dist/ folder... as you said, beforeEmit... here is my configuration for the command in package.json

"scripts": {
    "build": "webpack --mode production",
    "start": "webpack-dev-server --mode production --open --content-base dist/",
    ...
}

Any ideas how not to delete the dist/ upon launching the webpack-dev-server?

Thanks,
Ella

from clean-webpack-plugin.

a-siewe avatar a-siewe commented on June 1, 2024

I have the same issue

from clean-webpack-plugin.

SirNeuman avatar SirNeuman commented on June 1, 2024

Happens to me to. More often than not it works normally, but it does sometimes clean the folder after the bundle is built. I'm just using babel-loader.

from clean-webpack-plugin.

Clay-Ferguson avatar Clay-Ferguson commented on June 1, 2024

I see same issue. This plugin deletes my 'dist' folder AFTER the build is done, making it a bit counterproductive. haha.

from clean-webpack-plugin.

ChrisRAoW avatar ChrisRAoW commented on June 1, 2024

@flurdulis I would not suggest to use this option in development. Just for production environments.

from clean-webpack-plugin.

meglio avatar meglio commented on June 1, 2024

I can confirm that the plugin referenced by @jackypan1989 's above just solved my "-w" problem.

from clean-webpack-plugin.

chrisblossom avatar chrisblossom commented on June 1, 2024

Closed in v2.0.0 via #99. See johnagan/clean-webpack-plugin#usage. Please open a new issue if you continue to have problems.

from clean-webpack-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.