-
Notifications
You must be signed in to change notification settings - Fork 90
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
Rewire only in a test environment #210
base: master
Are you sure you want to change the base?
Conversation
2ae80ff
to
d7c4dcc
Compare
@BenjaminVanRyseghem sorry for the late reply. I have just had a look at your PR.Thank you for your work in providing this feature to babel-plugin-rewire. |
Thanks for your answer. I'm kinda new to babel, and didn't find how to specify environment in babelrc. |
@BenjaminVanRyseghem this is a sample of one of the projects I am involved. Please keep in mind that this is not the complete configuration and it is not checked against babel 7. For further information I would recommend the babel documentation itself: https://babeljs.io/docs/usage/babelrc/ In this example we have general plugins and presets which are applicable to all environments. {
"plugins": [
"transform-runtime",
"syntax-flow",
"transform-flow-strip-types"
],
"presets": [
"es2015",
"react"
],
"babelrc": false,
"env": {
"karma": {
"plugins": [
["istanbul", {
"exclude": [
"tests/**/*"
]
}], "rewire"
]
}
}
} Hope this is able to clarify your issue? |
Thanks! I'll have a look 😄 I found this stating it's deprecated, but I'll give it a try asap 😄 |
sorry for the delay 😄 It works, thank you. But as it seems deprecated, it looks like this will be needed anytime soon. |
As Babel 7 does/will not use |
ping? |
I'd be interested in getting this PR merged. We are on babel 7 and would like to only have this plugin run against spec files. |
Disabling ‘rewire’ in not-test environments could be a bad thing, as long using rewire in not-test(And not production) environment could be a good. |
I think this PR is still not needed, ok |
It looks like the babel team eventually decided they would continue to support env-specific configs in babelrc, so I think this issue can be closed. https://babeljs.io/docs/en/configuration#how-babel-merges-config-items I'm on babel 7 and this config is working for me: {
"env": {
"test": {
"plugins": [
"rewire"
]
}
}
}
|
Rewire conflict with babel-plugin-wildcard.
As a workaround (which could benefits others), I make rewire run only in a test environment.