-
Notifications
You must be signed in to change notification settings - Fork 31
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
Issue with babel 7 #43
Comments
What about something like that : https://github.com/Vincz/babel-plugin-transform-define/commit/5ba90a6ad8ba8fc4fa9b791d80409db0b1c3ab3d Or maybe We cannot use a string as plugin configuration anymore. So we have to use an object even for the file import feature and we need to know if the user want to have an object as config or if he wants to use a config file. I used to use it like that in my .babelrc :
|
thanks Vincz, I'm trying to test your fork. I edited my package.json like so:
|
@Vincz I've run into this same issue. Is there a reason you have not opened a PR with your proposed changes? Thanks! |
@binary64 You need to compile the package first (run |
@Vincz that makes sense, but opening a PR would at least prompt a discussion from this plugin's maintainers. It appears this issue has gone largely unnoticed by the maintainers. Hopefully a PR to address this breakage would gain more attention. In regards to your first point, I understand it is a breaking change, but it's already broken in Babel 7, so this change would likely be necessary. If I understand it correctly, support for passing a string as a babel plugin option was never intended, but was more recently rejection has been enforced with type checking. To your second point, I believe we could likely create an API for this plugin that would allow for continued support for both an inline config object and a file path. It would be easier to discuss that in a PR where the proposed changes are showcased though. Thanks for taking time to explore a fix! |
I just create a PR with @Vincz changes plus fixed tests => #49 And I published it here on npm: https://www.npmjs.com/package/babel-plugin-transform-define-file I try in my side, but I'm still have issue on nextjs 6.0.0... Let me know. EDIT. With nextjs 6, work fine if update |
Thank you @xcarpentier ! |
@Vincz @xcarpentier Hi. Please can you tell me what am I doing wrong?
.babel.rc
env-config
But in my component console.log('proc', process.env.BACKEND_URL) - undefined. |
Hi @chepelevdi |
@xcarpentier tnx a lot |
Hey, guys. I managed how to fix that passing an object config to this plugin using .babelrc.js instead of .babelrc:
|
@nathanqueija 's solution works for me. Thanks, @nathanqueija .. 🎉 |
@nathanqueija Thanks, works for me too. |
works for me too. Thanks, @nathanqueija |
* **BREAKING**: Change plugin options to **only** be a real JS object. Removes string configuration path option as now this is all possible with dynamic `.babelrc.js` or `babel.config.js` files. * **BREAKING**: Update to `@babel/core` / Babel 7+. Fixes #43 Closes #49, #50 * Lint all `test` code. Most diffs in this PR are those changes. Fixes #56 * Update other dependencies. Closes #55 * Remove dependency on babel6-only test library https://github.com/walmartlabs/assert-transform and do a simple function replacement.
When we define a config file like that :
We get the following error with babel 7 :
.plugins[1][1] must be an object, false, or undefined
The text was updated successfully, but these errors were encountered: