Couldn't find preset "env" relative to directory
See original GitHub issue- I have read the contribution documentation for this project.
- I agree to follow the code of conduct that this project follows, as appropriate.
- I have searched the issue tracker for an issue that matches the one I want to file, without success.
Please describe your issue:
I’m trying to dynamically require an external node_module that is located in /Users/name/plugin
due to babel-env (I guess) I’m getting the error stated below.
Is there a way to ignore everything outside of the actual project? I have tried using the ignore option with all possible options but they seem to be ignored.
"ignore": [
"plugins/**/*.js",
"/Users/name/plugins/**/*.js"
...
]
Console output when you run electron-forge
Error: Couldn't find preset "env" relative to directory "/Users/name/plugin/7ada6103-7315-4c24-93f3-4a3a6a0fa7ee"
at /Users/name/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:293:19
at Array.map (native)
at OptionManager.resolvePresets (/Users/name/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:275:20)
at OptionManager.mergePresets (/Users/name/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:264:10)
at OptionManager.mergeOptions (/Users/name/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:249:14)
at OptionManager.init (/Users/name/project/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
at File.initOptions (/Users/name/project/node_modules/babel-core/lib/transformation/file/index.js:216:65)
at new File (/Users/name/project/node_modules/babel-core/lib/transformation/file/index.js:139:24)
at Pipeline.transform (/Users/name/project/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
at BabelCompiler.compileSync (/Users/name/project/node_modules/electron-compilers/lib/js/babel.js:76:26)
contents of .compilerc
{
"env": {
"development": {
"application/javascript": {
"presets": [
[
"env",
{
"targets": {
"electron": "1.4.15"
}
}
],
"react"
],
"plugins": [
"transform-decorators-legacy",
"transform-flow-strip-types",
"transform-class-properties",
"transform-async-to-generator"
],
"sourceMaps": "inline"
}
},
"production": {
"application/javascript": {
"presets": [
[
"env",
{
"targets": {
"electron": "1.4.15"
}
}
],
"react"
],
"plugins": [
"transform-decorators-legacy",
"transform-flow-strip-types",
"transform-class-properties",
"transform-async-to-generator"
],
"sourceMaps": "none"
}
}
}
}
Please provide either a failing minimal testcase (with a link to the code) or detailed steps to
reproduce your problem. Using electron-forge init
is a good starting point, if that is not the
source of your problem.
Use a clean project (electron-forge init
) and try to import any random module from a folder that is not within module.paths
UPDATE: I’ve filed this issue on babel/babel-preset-env#186
Issue Analytics
- State:
- Created 7 years ago
- Comments:9 (5 by maintainers)
Top GitHub Comments
As a temporary workaround for your usecase you could just drop down to
babel-preset-es2015
@MarshallOfSound one thing I did forget to mention. It works if I write:
But that way, it’s hard to properly collaborate on this project.