FormidableLabs / babel-plugin-transform-define

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

OptionalMemberExpression? #90

Open lencioni opened 10 months ago

lencioni commented 10 months ago

I was looking at some code recently that uses process?.env?.NODE_ENV and was curious if this plugin supported transforming this type of code and if so what was the expected behavior. I looked through the implementation and tests and it looks like this is not currently supported in any way, so I'm wondering what you think about OptionalMemberExpression and ideally how it would work.

If the configuration specifies process.env.NODE_ENV that I would expect it to transform process?.env?.NODE_ENV and any other variations using OptionalMemberExpression. What are your thoughts?

Thank you!