Skip to content
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

Unknown option: .targets #6854

cyberalien opened this issue Nov 18, 2017 · 2 comments


Copy link

@cyberalien cyberalien commented Nov 18, 2017

I've encountered strange bug in 7.0.0-beta.32 when used with web pack when trying to set options for preset-env.

From webpack.config.js

            rules: [
                    test: /\.js$/,
                    exclude: /(node_modules|bower_components)/,
                    use: {
                        loader: 'babel-loader',
                        options: {
                            presets: ["@babel/preset-env", {
                                "targets": {
                                    "chrome": 52

Results in following error:

        at buildUnknownError (/node_modules/@babel/core/lib/config/options.js:79:11)
        at /node_modules/@babel/core/lib/config/options.js:65:57
        at Array.forEach (<anonymous>)
        at validate (/node_modules/@babel/core/lib/config/options.js:55:21)
        at /node_modules/@babel/core/lib/config/option-manager.js:259:36
        at cachedFunction (/node_modules/@babel/core/lib/config/caching.js:48:17)
        at loadPresetDescriptor (/node_modules/@babel/core/lib/config/option-manager.js:250:10)
        at /node_modules/@babel/core/lib/config/option-manager.js:52:14
        at (<anonymous>)
        at OptionManager.mergeOptions (/node_modules/@babel/core/lib/config/option-manager.js:51:34)
        at OptionManager.init (/node_modules/@babel/core/lib/config/option-manager.js:115:14)
        at manageOptions (/node_modules/@babel/core/lib/config/option-manager.js:31:30)
        at loadConfig (/node_modules/@babel/core/lib/config/index.js:15:37)
        at transformSync (/node_modules/@babel/core/lib/transform-sync.js:13:36)
        at Object.transform (/node_modules/@babel/core/lib/transform.js:20:65)
        at transpile (/node_modules/babel-loader/lib/index.js:55:20)
        at Object.module.exports (/node_modules/babel-loader/lib/index.js:179:20)

Error is triggered by second entry in "presets" array. Removing that entry results in everything working correctly, but trying to set any options results in errors.

babel/core version: 7.0.0-beta.32
babel/preset-env version: 7.0.0-beta.32
babel-loader version: 8.0.0-beta.0
webpack version: 3.8.1


This comment has been minimized.

Copy link

@babel-bot babel-bot commented Nov 18, 2017

Hey @cyberalien! We really appreciate you taking the time to report an issue. The collaborators
on this project attempt to help as many people as possible, but we're a limited number of volunteers,
so it's possible this won't be addressed swiftly.

If you need any help, or just have general Babel or JavaScript questions, we have a vibrant Slack
community that typically always has someone willing to help. You can sign-up here
for an invite.


This comment has been minimized.

Copy link

@cyberalien cyberalien commented Nov 18, 2017

Sorry, figured it out. Missed that preset with options should be in nested array.

Correct code:

                        presets: [
                            ['@babel/preset-env', {
                            targets: {
                                chrome: 52
@cyberalien cyberalien closed this Nov 18, 2017
@lock lock bot added the outdated label May 4, 2018
@lock lock bot locked as resolved and limited conversation to collaborators May 4, 2018
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
None yet
2 participants
You can’t perform that action at this time.