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

[Question] Specifying babel plugin configuration #9

Closed
sherwinyu opened this issue Oct 8, 2018 · 1 comment
Closed

[Question] Specifying babel plugin configuration #9

sherwinyu opened this issue Oct 8, 2018 · 1 comment

Comments

@sherwinyu
Copy link

Hi, I'm wondering how it would be possible to specify babel plugin configuration using the addBabelPlugin API. I've read

const addBabelPlugin = plugin => config => {
but I'm not very clear on what it's doing.

Namely, I'm trying to get flow-runtime's babel plugin working https://codemix.github.io/flow-runtime/#/babel-plugin-flow-runtime with configuration.

Normally, I'd configure it with .babelrc by adding something like:

{
  "presets": ["stage-2", "react"],
  "plugins": [
    "transform-decorators-legacy",
    ["flow-runtime", {
      "assert": true,
      "annotate": true,
      "optInOnly": true,
    }]
  ]
}

But customize-cra doesn't seem to be picking up the config.

Any help would be appreciated, and thanks for the work on this!

@arackaf
Copy link
Owner

arackaf commented Oct 8, 2018

CRA doesn't use the .babelrc file. I believe you'd want

addBabelPlugin(["flow-runtime"]);

Basically, whatever you pass to addBabelPlugin will be passed to Babel's plugins array in the webpack config. Check Babel's docs for how to set that up.

@arackaf arackaf closed this as completed Oct 8, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants