Giter Site home page Giter Site logo

Comments (16)

harshes53 avatar harshes53 commented on August 18, 2024 62

@fr-ench

Give a try root: process.cwd()

It did worked for me!

from clean-webpack-plugin.

harshes53 avatar harshes53 commented on August 18, 2024 46

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

rewmike avatar rewmike commented on August 18, 2024 9
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.

fr-ench avatar fr-ench commented on August 18, 2024 8

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

rewmike avatar rewmike commented on August 18, 2024 1

I am having the same issue.

from clean-webpack-plugin.

fr-ench avatar fr-ench commented on August 18, 2024 1

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.

fr-ench avatar fr-ench commented on August 18, 2024 1

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

chrisblossom avatar chrisblossom commented on August 18, 2024

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

from clean-webpack-plugin.

chrisblossom avatar chrisblossom commented on August 18, 2024

@fr-ench please provide your config.

from clean-webpack-plugin.

fr-ench avatar fr-ench commented on August 18, 2024

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

harshes53 avatar harshes53 commented on August 18, 2024

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

chrisblossom avatar chrisblossom commented on August 18, 2024

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.

chrisblossom avatar chrisblossom commented on August 18, 2024

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

from clean-webpack-plugin.

chrisblossom avatar chrisblossom commented on August 18, 2024

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

fr-ench avatar fr-ench commented on August 18, 2024

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

from clean-webpack-plugin.

chrisblossom avatar chrisblossom commented on August 18, 2024

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

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.