@stylexjs/babel-plugin `runtimeInjection` option behavior change between 0.3 and 0.4
The problem
There are cases in which we might want runtimeInjection: false (like when developing an SSR app), but we still want to use dev: true to provide dev friendly class names.
On the latest version of @stylexjs/babel-plugin, the code changed from
https://github.com/facebook/stylex/blob/4e1be339307785e805caf9c1b0ec0618b81e3a44/packages/babel-plugin/src/utils/state-manager.js#L86-L87
to
https://github.com/facebook/stylex/blob/a3528b69d567bcf5c61c6e92e86312bcac8e6122/packages/babel-plugin/src/utils/state-manager.js#L99-L106
Before, the plugin used ??, which checked for null and undefined; now, it uses ternaries, which check for falseness. This means it will ignore an explicit runtimeInjection: false configuration and fall back to checking for dev.
How to reproduce
Steps to reproduce:
- Using the babel-plugin, pass
dev: trueandruntimeInjection: false. - Runtime will be injected.
Expected behavior
Plugin shouldn't inject the runtime if runtimeInjection is set to false
Environment (include versions). Did this work in previous versions? 0.4.1 version of the babel plugin. It did work in 0.3.0.
I already have a PR up to fix this. #298
Fixed in 0.5.0