env@2: `debug: true` fails with Invalid Version: false.0.0
tleunen opened this issue · comments
When enabling debug
, I'm getting this error:
babel-preset-env: `DEBUG` option
Using targets:
TypeError: [BABEL] /xxx/src/providers/message.js: Invalid Version: false.0.0 (While processing: "/xxx/node_modules/babel-preset-env/lib/index.js")
at new SemVer (/xxx/node_modules/semver/semver.js:293:11)
at Function.major (/xxx/node_modules/semver/semver.js:551:10)
at prettifyVersion (/xxx/node_modules/babel-preset-env/lib/utils.js:33:33)
at /xxx/node_modules/babel-preset-env/lib/utils.js:55:15
at Array.reduce (<anonymous>)
at prettifyTargets (/xxx/node_modules/babel-preset-env/lib/utils.js:51:31)
at buildPreset (/xxx/node_modules/babel-preset-env/lib/index.js:226:59)
at loadDescriptor (/xxx/node_modules/babel-core/lib/config/option-manager.js:252:14)
at loadPresetDescriptor (/xxx/node_modules/babel-core/lib/config/option-manager.js:334:14)
at /xxx/node_modules/babel-core/lib/config/option-manager.js:76:14
Here's my config:
presets: [
[
'env',
{
targets: {
forceAllTransforms: false,
ignoreBrowserslistConfig: true,
node: 'current',
},
modules: 'commonjs',
loose: true,
useBuiltIns: 'usage',
debug: true,
exclude: ['transform-regenerator', 'transform-async-to-generator'],
},
],
'react',
],
@tleunen thanks for the report.
We can certainly provide a better error message here, but you have two options inside of targets
that are invalid (forceAllTransforms
, ignoreBrowserslistConfig
).
Oh I see. Thank you.
I misread your message at first. These properties should be outside of targets
, not inside. I should have misread the readme. My bad :)
Meaning you don't want to declare targets? You can simply omit it, and it won't attempt to do any target-related filtering.
Yep! Sorry, I misread at first ;)
Everything looks good now :)