-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
ENOENT: no such file or directory, open '.svgo.yml' #1214
Comments
While this is still an issue, I'm closing it since I found a workaround by excluding the For Vue CLI module.exports = {
pluginOptions: {
electronBuilder: {
nodeIntegration: true,
externals: ["svgo"]
}
}
}; For a traditional module.exports = {
externals: {
svgo: 'svgo'
}
}; |
@iamazik did you have to make any other changes than adding it to externals and making sure its not a devDependency? After I add it to externals I simply get |
No, I didn't need to modify anything else after adding |
As a workaround, if you add |
That's a huge tip @adamaveray, it solved my problem! I had solved my issue with electron following @iamazik tip, but I'm working on something else now that is web only and was trying to get SVGO to work. Your tip couldn't have come at a better time! Thanks! |
Description
Having the
ENOENT: no such file or directory, open '.svgo.yml'
issue in an Electron app based on Vue CLI that is https://github.com/nklayman/vue-cli-plugin-electron-builder. It looks like a common issue foryarn clean
. However, I don't runyarn clean
, nor I have a.yarnclean
file in my project that enablesyarn clean
automatically.It looks like Electron builder cannot reference the
.svgo.yml
file from the following when using__dirname
, noryaml.safeLoad()
is requiring the relevant file from their end. So, Electron builder is having trouble with this.svgo/lib/svgo/config.js
Line 30 in 07ca976
Fix proposal
Why do we use an
.yml
file for the configuration instead of a normal.js
file so that we can simplyrequire()
the config file and let Node handles it? I am sorry if I am missing the point here. I understand that.yml
file config might be a bit easier but for avoiding this issue, I believe having the.js
config file is the best.We can still simply return an object from the
.js
config like we do from.yml
config file like the following way:This will also allow the
defaults = Object.assign({}, yaml.safeLoad(FS.readFileSync(__dirname + '/../../.svgo.yml', 'utf8')));
with simplydefaults = Object.assign({}, require('../../.svgo.js'));
and it works for both Electron, Website, and as well as for the CLI.The text was updated successfully, but these errors were encountered: