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

Cannot use plugin or preset options #37

Closed
razor-x opened this issue Aug 15, 2016 · 2 comments
Closed

Cannot use plugin or preset options #37

razor-x opened this issue Aug 15, 2016 · 2 comments

Comments

@razor-x
Copy link
Contributor

razor-x commented Aug 15, 2016

I believe these lines:

const mappedPresets = opts.presets.map(ps => resolve(config.paths.root, 'node_modules', `babel-preset-${ps}`));
const mappedPlugins = opts.plugins.map(pg => resolve(config.paths.root, 'node_modules', `babel-plugin-${pg}`));

means that setting plugin or preset options is not supported, e.g.,

{
  "plugins": [
    ["transform-async-to-module-method", {
      "module": "bluebird",
      "method": "coroutine"
    }]
  ]
}

{
  "presets": [
    ["es2015", { "loose": true, "modules": false }]
  ]
}

as ${ps} would resolve to ["es2015", { "loose": true, "modules": false }].

Trying to set options fails with an Unknown plugin error.

@razor-x
Copy link
Contributor Author

razor-x commented Aug 16, 2016

Quick followup: it seems preset options are working correctly (maybe someone can confirm this), but plugin options fail:

15 Aug 16:59:31 - error: Compiling of app/constants/messages/index.js failed. Unknown plugin "/<FULL_PATH>/node_modules/babel-plugin-transform-async-to-module-method,[object Object]" specified in "base" at 0, attempted to resolve relative to "app/constants/messages" 

This is testing with the above plugin config example above inside package.json.

razor-x added a commit to rxfork/babel-brunch that referenced this issue Aug 16, 2016
@razor-x
Copy link
Contributor Author

razor-x commented Aug 16, 2016

Quick attempt at handling options (added an extra test): rxfork@afb0083

Should we have test coverage for presets and plugins given in both forms and check the options actually get handled by babel? Would need to depend on some presets / plugins that actually have extra options to test that.

razor-x added a commit to rxfork/babel-brunch that referenced this issue Aug 17, 2016
razor-x added a commit to rxfork/babel-brunch that referenced this issue Aug 17, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants