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

plugin clean folder even on re-build #55

Closed
shlomisas opened this issue May 28, 2017 · 4 comments
Closed

plugin clean folder even on re-build #55

shlomisas opened this issue May 28, 2017 · 4 comments

Comments

@shlomisas
Copy link

I have this config:

new CleanWebpackPlugin(['dist'], {
    root: projectRoot,
    watch: false
})

But when the watcher run it deletes the folder and start the whole Webpack's build from scratch.
I know the watch flag is false by default, I added that to make sure it's settled.

I'm using Webpack version 1 due to some IE backward compatibilities, maybe this is the issue?

Thanks.

@Jonathancollinet
Copy link

look at this

Paths (Required)

An [array] of string paths to clean

[
  'dist',         // removes 'dist' folder
  'build/*.*',    // removes all files in 'build' folder
  'web/*.js'      // removes all JavaScript files in 'web' folder
]

@shlomisas
Copy link
Author

shlomisas commented May 30, 2017

as you can see in my code sample, i already have ['dist'] array as paths to clean, but it still deletes it everytime the watcher build instead of just on the first web pack build.

@ianseverance
Copy link

@shlomisas As originally mentioned by @Jonathancollinet and stated in the documentation:

By passing dist as the path, you are asking for the dist folder itself to be cleaned (removed). To remove all of the files within the dist folder, your config should actually be

new CleanWebpackPlugin([
   'dist/*.*'          // Removes all files in `dist` folder
],
{
    root: projectRoot,
    watch: false       // You can delete this, as this does not change anything for your use case
})

and if your dist folder has multiple levels, make sure to include those paths as well

new CleanWebpackPlugin([
   'dist/*.*'          // Removes all files in `dist` folder
   'dist/**/*.*'       // Removes all files in `dist/**` folders
   'dist/**/**/*.*'    // Removes all files in `dist/**/**` folders
],
{
    root: projectRoot,
    watch: false       // You can delete this, as this does not change anything for your use case
})

crazko pushed a commit to crazko/kalendario that referenced this issue Mar 4, 2019
## The devDependency [clean-webpack-plugin](https://github.com/johnagan/clean-webpack-plugin) was updated from `1.0.1` to `2.0.0`.
This version is **not covered** by your **current version range**.

If you don’t accept this pull request, your project will work just like it did before. However, you might be missing out on a bunch of new features, fixes and/or performance improvements from the dependency update.

---

<details>
<summary>Release Notes for v2.0.0</summary>

<p><a href="https://urls.greenkeeper.io/chrisblossom/clean-webpack-plugin/blob/2.0/README.md">README.md</a></p>
<p>Changes:</p>
<ul>
<li>No configuration is needed for standard usage (cleans webpack's <code>output.path</code>)</li>
<li>By default during webpack's watch mode, only files created by webpack are removed</li>
<li>Because <a href="https://www.npmjs.com/package/del" rel="nofollow">del</a> is used, globbing is supported</li>
<li>Plugin is tested directly via webpack</li>
<li>All supported versions are tested</li>
<li>Windows is tested via <a href="https://www.appveyor.com/" rel="nofollow">appveyor</a> (no mocked tests)</li>
<li>Complete build system including prepublish hooks and git prepush/commit hooks</li>
<li>Written with Typescript</li>
</ul>
<p>Additional notes:</p>
<ul>
<li>Moved to <a href="https://circleci.com/" rel="nofollow">CircleCI</a> because <a href="https://news.ycombinator.com/item?id=18978251" rel="nofollow">Travis CI was sold</a> and <a href="https://news.ycombinator.com/item?id=19218036" rel="nofollow">looks to now be in maintenance mode</a>.</li>
<li>Replaced Coveralls with <a href="https://codecov.io/" rel="nofollow">codecov</a> because automatic build merging works. This is important because of windows/different webpack version testing</li>
</ul>
<p>Please discuss the current API and suggest any changes.</p>
<p>Closes Issues: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="228815640" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#53" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/53/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/53">#53</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="231858021" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#55" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/55/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/55">#55</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="261623866" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#67" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/67/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/67">#67</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="295742643" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#73" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/73/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/73">#73</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="310004405" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#80" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/80/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/80">#80</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="324754162" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#85" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/85/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/85">#85</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="336239767" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#86" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/86/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/86">#86</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="350539725" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#89" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/89/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/89">#89</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="355469528" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#91" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/91/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/91">#91</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="359168546" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#92" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/92/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/92">#92</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="360576175" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#93" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/93/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/93">#93</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="395851254" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#98" data-hovercard-type="issue" data-hovercard-url="/johnagan/clean-webpack-plugin/issues/98/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/issues/98">#98</a><br>
Closes PRs: <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="203192494" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#39" data-hovercard-type="pull_request" data-hovercard-url="/johnagan/clean-webpack-plugin/pull/39/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/pull/39">#39</a> <a class="issue-link js-issue-link" data-error-text="Failed to load issue title" data-id="296175694" data-permission-text="Issue title is private" data-url="johnagan/clean-webpack-plugin#74" data-hovercard-type="pull_request" data-hovercard-url="/johnagan/clean-webpack-plugin/pull/74/hovercard" href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/pull/74">#74</a></p>
<p>Massive props to <a class="user-mention" data-hovercard-type="user" data-hovercard-url="/hovercards?user_id=1595871" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://urls.greenkeeper.io/chrisblossom">@chrisblossom</a> for working on this and pushing it through.</p>
</details>

<details>
<summary>Commits</summary>
<p>The new version differs by 16 commits.</p>
<ul>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/2e7f7f63699460d827329c04779001a237113f57"><code>2e7f7f6</code></a> <code>2.0.0</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/e90a300fdab0f36e671461bb2ccfbd93f288554c"><code>e90a300</code></a> <code>remove unused babel plugins</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/0ff10f0260aaf4dfd20a0a23850a188b64f856a6"><code>0ff10f0</code></a> <code>windows test fixes</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/d6e2e3821fcca8edd9e68ca4cf57198a82e86bb8"><code>d6e2e38</code></a> <code>use *<em>/</em> instead of ** and update packages</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/e19b19d13f5f9f4bc6495afb4d51773dff8d616a"><code>e19b19d</code></a> <code>reorder option types</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/03d12acc097de106d6b218e5954059beae55a04a"><code>03d12ac</code></a> <code>add protectWebpackAssets option</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/f506dc612bb7c9e946f8fa4f1014db7a74a23a67"><code>f506dc6</code></a> <code>add cleanStaleWebpackAssets option</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/c730f4513f80de9192255cdee4ed831d1d94e199"><code>c730f45</code></a> <code>cleanAfterEveryBuildPatterns should not remove webpack assets</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/6d6b34185ab3bc8ce657d7d46023f5311d4ed612"><code>6d6b341</code></a> <code>initialPatterns renamed to cleanOnceBeforeBuildPatterns, customPatterns renamed to cleanAfterEveryBuildPatterns</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/5e5a51914123e35c07ece8f2c8cadaff9f9f39df"><code>5e5a519</code></a> <code>do not include customPatterns in initialPatterns</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/3830778a378b17d26a40c83310a8b4b04a3dfe62"><code>3830778</code></a> <code>use circleci instead of travis</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/bdb5099c7ea65eca177ca5c8c0306338aa39ab1d"><code>bdb5099</code></a> <code>readme updates</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/d2ac5160892d9ebfe2d1056f5d72edd9b3e217e9"><code>d2ac516</code></a> <code>require dangerouslyAllowCleanPatternsOutsideProject to explicitly set dry to false</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/68893e872f716c4e2efc79746bc114aead323748"><code>68893e8</code></a> <code>allowExternal renamed to dangerouslyAllowCleanPatternsOutsideProject</code></li>
<li><a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/commit/816732823b3178420565fac5cb1b2208b5bdb809"><code>8167328</code></a> <code>by default remove all files once prior to compilation, add allowExternal option, migrate dryRun to dry</code></li>
</ul>
<p>There are 16 commits in total.</p>
<p>See the <a href="https://urls.greenkeeper.io/johnagan/clean-webpack-plugin/compare/277811552e04b705b1ad840365eb493a54f6457e...2e7f7f63699460d827329c04779001a237113f57">full diff</a></p>
</details>

<details>
  <summary>FAQ and help</summary>

  There is a collection of [frequently asked questions](https://greenkeeper.io/faq.html). If those don’t help, you can always [ask the humans behind Greenkeeper](https://github.com/greenkeeperio/greenkeeper/issues/new).
</details>

---


Your [Greenkeeper](https://greenkeeper.io) bot 🌴
@chrisblossom
Copy link
Collaborator

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

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