Allow empty plugin options. by izaakschroeder · Pull Request #14 · gaearon/babel-plugin-react-transform · GitHub
Skip to content
This repository was archived by the owner on Apr 9, 2020. It is now read-only.

Allow empty plugin options.#14

Merged
gaearon merged 1 commit into
gaearon:masterfrom
izaakschroeder:allow-empty-options
Sep 16, 2015
Merged

Allow empty plugin options.#14
gaearon merged 1 commit into
gaearon:masterfrom
izaakschroeder:allow-empty-options

Conversation

@izaakschroeder

Copy link
Copy Markdown
Contributor

This allows for a conditional extra parameter to not throw an error when using babel programatically (i.e. not via .babelrc). For example:

extra: {
  'react-transform': env !== 'production' ? [{
    target: 'react-transform-webpack-hmr',
    imports: [ 'react' ],
    locals: [ 'module' ]
  }] : [ ] // This would otherwise balk.
}

Arguably one could simply check if there are no extra values for the plugin and simply not load it.

This allows for a conditional `extra` parameter to not throw an error when using babel programatically (i.e. not via `.babelrc`). For example:

```javascript
extra: {
  'react-transform': env !== 'production' ? [{
    target: 'react-transform-webpack-hmr',
    imports: [ 'react' ],
    locals: [ 'module' ]
  }] : [ ] // This would otherwise balk.
}
```

Arguably one could simply check if there are no `extra` values for the plugin and simply not load it.
@izaakschroeder

Copy link
Copy Markdown
Contributor Author

gaearon added a commit that referenced this pull request Sep 16, 2015
@gaearon gaearon merged commit 2d507af into gaearon:master Sep 16, 2015
@gaearon

gaearon commented Sep 16, 2015

Copy link
Copy Markdown
Owner

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants