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

Prevent auto run when call webpack() #29

Closed
agusputra opened this issue Oct 9, 2016 · 5 comments
Closed

Prevent auto run when call webpack() #29

agusputra opened this issue Oct 9, 2016 · 5 comments

Comments

@agusputra
Copy link

agusputra commented Oct 9, 2016

It seems this plugin auto run when we call webpack(options).

How to to configure this plugin to not auto run ?

ex:

//This plugin auto run and the directory now clean after call webpack(). But I don't want it.
compiler = webpack(options);

//How to configure this plugin, so it run when compiler.run() called?
compiler.run()
@hustcer
Copy link

hustcer commented Oct 9, 2016

I have the same issue here at v0.1.12, it just don't clean as before: I want it to clean the directory when I first run the task like npm run dev, then after any later file changes, the directory need not be cleaned, It's just an incremental build, not a full build. At least it should be configurable.
So I have to revert to v0.1.11. Or do I use it in the wrong way?

@johnagan
Copy link
Owner

johnagan commented Oct 10, 2016

@tylerhou this seems to be a result of your PR #26. Should I roll this back?

@johnagan
Copy link
Owner

johnagan commented Oct 10, 2016

I rolled back #30 until it's resolved. v0.1.13 includes the rollback

@tylerhou
Copy link
Contributor

Sorry about that. I didn't realize that it would run there too. Perhaps the best solution is to have an option watch (default: false) which would attach the event listener if true.

@tylerhou
Copy link
Contributor

tylerhou commented Oct 13, 2016

On closer inspection, this isn't a problem with the pull request I made. Here's a repo of the bug at v0.1.13:

// index.js
var CleanWebpackPlugin = require('clean-webpack-plugin');
var webpack = require("webpack");

var compiler = webpack({
  plugins: [
    new CleanWebpackPlugin(['dist'])
  ]
});

$ node index.js
dist gets deleted.

@hustcer your bug isn't the same; it's a duplicate of #31. #31 is also incorrect in referencing this bug as the two are not linked.

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

No branches or pull requests

4 participants