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

clean-webpack-plugin: /Users/user/.../ must be inside the project root. Skipping... #10

Closed
stianlp opened this issue Jan 14, 2016 · 16 comments · Fixed by #14
Closed

clean-webpack-plugin: /Users/user/.../ must be inside the project root. Skipping... #10

stianlp opened this issue Jan 14, 2016 · 16 comments · Fixed by #14

Comments

@stianlp
Copy link

stianlp commented Jan 14, 2016

I get this error after updating to 0.1.6.

If i revert to 0.1.4, it works fine. Is it possible to add an option to clean outside project root in the upcoming versions?

@rewmike
Copy link

rewmike commented Jan 14, 2016

I am having the same issue.

@chrisblossom
Copy link
Collaborator

@stianlp @rewmike Please provide your config so I can test. Please include all relevant directories.

@fr-ench
Copy link

fr-ench commented Jan 24, 2016

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.

@chrisblossom
Copy link
Collaborator

@fr-ench please provide your config.

@fr-ench
Copy link

fr-ench commented Jan 25, 2016

@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.

@harshes53
Copy link

@fr-ench

Give a try root: process.cwd()

It did worked for me!

@fr-ench
Copy link

fr-ench commented Jan 25, 2016

@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
}).

@rewmike
Copy link

rewmike commented Jan 25, 2016

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.

@harshes53
Copy link

@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.

@fr-ench
Copy link

fr-ench commented Jan 26, 2016

@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.

@harshes53
Copy link

@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.

@chrisblossom
Copy link
Collaborator

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?

@chrisblossom
Copy link
Collaborator

@fr-ench can you try again with case-sensitive inputs including a capital Z:? I think this is the issue.

@chrisblossom
Copy link
Collaborator

@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.

@fr-ench
Copy link

fr-ench commented Jan 27, 2016

@chrisblossom,

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.

@chrisblossom
Copy link
Collaborator

Thanks for testing it out. @fr-ench PR #14 submitted

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

Successfully merging a pull request may close this issue.

5 participants