-
-
Notifications
You must be signed in to change notification settings - Fork 248
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
Cannot find module - config file not found #137
Comments
thanks for reporting this, it looks like a bug on windows, in this path |
Agreed, that's what I commented on the StackOverflow bug too. Hopefully it's not too bad to fix. |
Ill have to first setup a VM with windows to test this but a possible workaround would be to just not use a config file and use purgecss programmatically. Create a const Purgecss = require('purgecss')
const fs = require('fs')
const path = require('path')
const outputDir = path.resolve(__dirname, 'dist')
const purgecss = new Purgecss({
content: ['src/*.html'],
css: ['src/*.css']
})
const result = purgecss.purge()
result.forEach(out => {
const filePath = out.file.split('/')
fs.writeFileSync(`${outputDir}/${filePath[filePath.length - 1]}`, out.css, 'utf-8')
})
console.log('done') then just run it with |
I've fixed the issue on my end by simply replacing
I'm assuming since Maybe someone else can research if this change would cause any issues? |
The fix from @alexqhj worked in my windows machine. |
I finally got this to work by putting a symlink to the node_modules directory (named "node_modules") in each directory where I was running purgecss from. |
This problem still exists under windows. |
Describe the bug
When I try to run my build I'm getting an error that the config file can't be found.
To Reproduce
Steps to reproduce the behavior:
"purgecss": "purgecss -c purgecss.config.js -o src"
module.exports = { content: ['src/index.js'], css: ['src/tailwind.css'] }
yarn run build
Error: Error loading the config fileCannot find module '/C:\GitHub\repo/purgecss.config.js
Expected behavior
Build should happen with css purged
Desktop (please complete the following information):
Additional context
This was raised on StackOverflow as well: https://stackoverflow.com/questions/51569213/purgecss-cli-c-cannot-find-module-purgecss-config-js/52277041
The text was updated successfully, but these errors were encountered: