Comments (8)
Okay, this fix has been released as 2.1.3
! Thanks, all, for reporting, putting a solution together, and nudging this across the finish line!
from babel-plugin-transform-define.
Thanks for opening that issue @tomekzaw .
I can see different cases:
const obj = {
__DEV__
};
const obj = {
__DEV__: __DEV__
};
const obj = {
"__DEV__": __DEV__
};
const obj = {
["__DEV__"]: __DEV__
};
Should output:
var obj = {
"__DEV__": true
};
Meanwhile
const obj = {
[__DEV__]: __DEV__
};
Should be the only one that also affect the key
from babel-plugin-transform-define.
Agreed, in my view [__DEV__]: __DEV__
should see the key being replaced as the []
indicate to me, it is calculated where the others are just strings or non replaceable keys.
from babel-plugin-transform-define.
Hi @Titozzz - thanks for resurfacing this. I'm a bit swamped this week, but will try to check this out first thing next week!
from babel-plugin-transform-define.
This behavior description is accurate.
So, we tackled things with bindings in #81
I'm not totally sure if we should skip object keys or if there are legitimate use cases to replace those.... Thoughts @carloskelly13 @gksander ?
As an aside, if you switch to string keys, you can get an equivalent, non-error output:
const obj = {
"__DEV__": __DEV__
};
outputs to:
var obj = {
"__DEV__": true
};
from babel-plugin-transform-define.
Hello there, gentle nudge to the issue, since I feel we all agree on the problem, what are the steps moving forward, should we expect you guys to fix it at some time or will you want a pull request?
No idea what this issue would take to be fixed, but happy to give a hand!
cc @ryan-roemer @carloskelly13
from babel-plugin-transform-define.
Went ahead and created the PR
from babel-plugin-transform-define.
gentle nudge @ryan-roemer @carloskelly13 @gksander
from babel-plugin-transform-define.
Related Issues (15)
- Unclear errors with external/requirable config file HOT 2
- Accepting `baseDir` in plugin config HOT 1
- Can't define some values that equals false with Boolean operation HOT 3
- Getting cryptic error if the file to return ENV object return null or {} instead HOT 1
- Issue with babel 7 HOT 14
- Deprecate it HOT 2
- Lodash 4.17.4 is not safe HOT 5
- wrong babel cache using filepath as entry point HOT 3
- Infra: Add `test` to linting.
- Infra: Don't transpile `src/index.js`
- ES module identifier imports throwing
- Calling `getSortedObjectPaths` frequently leads to performance issues
- should not transform identifiers with binding
- OptionalMemberExpression?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from babel-plugin-transform-define.