babel: Unknown option: base.presets[]

I can’t access to the options of a preset without throwing an Unknown option: base.presets[] error

This is my setup for babel using webpack@2.2.0 Works perfectly without the presets options but would be nice to be able to access them.

module.exports = {
  test: /\.js$/,
  loader: 'babel-loader',
  exclude: /node_modules/,
  options: {
    presets: [
      [require.resolve('babel-preset-latest'), {
        "es2015": {
          "modules": false
        }
      }],
      require.resolve('babel-preset-stage-3')
    ],
    plugins: [
      require.resolve('babel-plugin-transform-regenerator')
    ]
  }
}

This is the error in the console

Module build failed: ReferenceError: [BABEL] /web/matteogabriele/beta/src/app/page/home/home.js: Unknown option: base.presets[]. Check out http://babeljs.io/docs/usage/options/ for more information about options.

A common cause of this error is the presence of a configuration options object without the corresponding preset name. Example:

Invalid:
  `{ presets: [{option: value}] }`
Valid:
  `{ presets: [['presetName', {option: value}]] }`

For more detailed information on preset configuration, please see http://babeljs.io/docs/plugins/#pluginpresets-options.
    at Logger.error (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-core/lib/transformation/file/logger.js:41:11)
    at OptionManager.mergeOptions (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:226:20)
    at OptionManager.init (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:368:12)
    at File.initOptions (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-core/lib/transformation/file/index.js:216:65)
    at new File (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-core/lib/transformation/file/index.js:139:24)
    at Pipeline.transform (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-core/lib/transformation/pipeline.js:46:16)
    at transpile (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-loader/lib/index.js:46:20)
    at Object.module.exports (/web/blocklevel/blue-next/packages/bcli/node_modules/babel-loader/lib/index.js:134:16)
 @ ./src/app/page/home/home.vue 8:2-472
 @ ./src/app/routes.js
 @ ./src/bootstrap.js
 @ multi ./src/bootstrap.js

The error itself is pretty nice when you write it wrong, but here I guess I’m doing in correctly.

Thanks in advance for you help

software version
Babel v6.21.0
node v7.4.0
npm v4.1.1
Operating System MacOS Sierra 10.12.2

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

@MatteoGabriele no problem! Let us know if you find any issues!

@MatteoGabriele mind creating a small repo that repros the issue outside of your CLI project?