Comments (16)
Give a try root: process.cwd()
It did worked for me!
from clean-webpack-plugin.
@fr-ench what is your process.cwd()
and __dirname
?
Make sure you absolutely target the folder. I did tried a lot and what to bang my head but then tried root: process.cwd()
I have this project structure:
--build-config/
-----devConfig.js
--client/
-----dist/
The config below also worked for me:
plugins:[
new CleanWebpackPlugin(['client/dist'], { root: path.resolve(__dirname , '..'), verbose: true })
]
And I am bundling with this command from my root of the project:
webpack --config build-config/dev.config.js --watch
Make sure you give correct root path.
from clean-webpack-plugin.
clean-webpack-plugin: /var/www/vhosts/[domain.com]/app project root is outside of project. Skipping all...
My webpack.config.js:
new CleanPlugin(['build'], { root: __dirname })
My project structure:
.
├─ build
├─ source
└── webpack.config.js
I don't think that __dirname
should be used in clean-webpack-plugin/index.js
- it's not perfect.
from clean-webpack-plugin.
@hatchbee , unfortunately, I'm still getting the same error:
"clean-webpack-plugin: Z:\dist must be inside the project root. Skipping..."
with
new Clean(["dist"], {
root: process.cwd(),
verbose: true,
dry: false
}).
from clean-webpack-plugin.
I am having the same issue.
from clean-webpack-plugin.
I am having the same issue as well. My project root is "z:/" , and I'm trying to delete 'dist' folder, which path is 'z:/dist'.
Reverting back to 0.1.4 fixes the issue.
from clean-webpack-plugin.
@chrisblossom, here it is:
var Clean = require('clean-webpack-plugin');
...
plugins: (function () {
var plugins = [
new Clean(["dist"], {
root: 'z:/',
verbose: true,
dry: false
}),
....
];
return plugins;
})()
...
I've also tried root options as '/' but no help unfortunately.
I'm on windows and running node v5.5.0 if it can be helpful.
from clean-webpack-plugin.
@stianlp @rewmike Please provide your config so I can test. Please include all relevant directories.
from clean-webpack-plugin.
@fr-ench please provide your config.
from clean-webpack-plugin.
@hatchbee,
That doesn't help either.
Actually I believe the bug is on line 63:
var projectDirSplit = projectDir.split(path.sep);
I have projectDir = "z:/" which produces an array ["z:", ""]. There is an excessive empty array element "" in the end.
So we're getting an excessive check here
projectDirSplit.forEach((function(singleDir, index) {
if (pathSplit[index] !== singleDir) {
insideFailCheck = true;
}
}));
which results in insideFailCheck = true;
Probably your root variable doesn't end with a path separator, that is why it's working for you. But I use subst command to mount a "z:" drive and work from z:/ directly so just changing the plugin settings won't work for me.
from clean-webpack-plugin.
@fr-ench just double check the way path.resolve
works on Windows machine with drive paths. Sorry I haven't used it for development since.
from clean-webpack-plugin.
The tests are failing on windows. I am looking into a solution right now. Thanks for the input @fr-ench.
Side note (haven't researched), is it possible for Travis-ci to test on windows hosts as well?
from clean-webpack-plugin.
@fr-ench can you try again with case-sensitive inputs including a capital Z:? I think this is the issue.
from clean-webpack-plugin.
@fr-ench Can you try this branch: https://github.com/chrisblossom/clean-webpack-plugin/tree/feature/windows_fixes and see if your issues are fixed? Please advise.
from clean-webpack-plugin.
The windows_fixes branch works just perfect for me! Thank you!
Do you think it'll make its way to master branch in the nearest future?
As for case sensitivity, I don't think that was the case, because I tried different cominations at the very beginning.
from clean-webpack-plugin.
Thanks for testing it out. @fr-ench PR #14 submitted
from clean-webpack-plugin.
Related Issues (20)
- Console warn on new line
- The typings issue while upgrade to [email protected] HOT 7
- webpack 5 output path error HOT 2
- Type 'CleanWebpackPlugin' is not assignable to type '((this: Compiler, compiler: Compiler) => void) HOT 1
- upgrading from 0.1.19 to 3.0.0 doubt
- Bad type declaration in "clean-webpack-plugin.d.ts" HOT 1
- clean-webpack-plugin: options.output.path not defined. Plugin disabled... HOT 15
- Expose glob options to distinguish files and directories
- Deprecate plugin in favor `output.clean` HOT 8
- dry: true result different from real run
- v4.0.0-alpha.0 is released as `latest` HOT 5
- Does the order of clean-webpack-plugin matter? HOT 2
- Old dependency on del causes errors on Windows
- cleanAfterEveryBuildPatterns: ['*.LICENSE.txt'] doesn't seem to work HOT 2
- Excluding files & folders not working HOT 1
- Cannot read properties of undefined (reading 'emit')
- Maintenance HOT 1
- Outdated version of package "del" causes TypeScript project compile failures HOT 2
- Security Issue in Unmaintained Dependency: clean-webpack-plugin
- [del] Some internal modules are deprecated. HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from clean-webpack-plugin.