FormidableLabs / babel-plugin-transform-define

Compile time code replacement for babel similar to Webpack's DefinePlugin
MIT License
245 stars 31 forks source link

Search parent directories for config file #50

Closed jkoskela closed 5 years ago

jkoskela commented 6 years ago

I was having problems using this plugin with react-native. The issue is that the react-native packager (metro) runs in a subdirectory of node_modules. However, my tests run from the root directory of my package. So they need different paths for the config file passed to transform-define.

This searches recursively for the config file specified as an argument to the plugin. It follows pattern from .babelrc node_modules, etc.

robatron commented 6 years ago

Awesome! This is exactly what I was looking for, and it works perfectly in my project :-)

ryan-roemer commented 5 years ago

We've got a new PR up at https://github.com/FormidableLabs/babel-plugin-transform-define/pull/57 for full babel7 support with a different approach for dynamic configurations of leaving it to babel7 .babelrc.js and babel.config.js loading and execution semantics (environment vars, etc.).

This is a different approach than extending the bespoke configuration file search semantics, but hopefully the power of real JS, env vars, etc. in babel7 allows all use cases to be met?

ryan-roemer commented 5 years ago

Closing in favor of #57