Skip to content
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

@stylexjs/babel-plugin runtimeInjection option behavior change between 0.3 and 0.4 #308

Closed
HorusGoul opened this issue Jan 4, 2024 · 2 comments

Comments

@HorusGoul
Copy link

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

runtimeInjection:
(options: $FlowFixMe).runtimeInjection ?? !!(options: $FlowFixMe).dev,

to

runtimeInjection:
options.runtimeInjection === true
? DEFAULT_INJECT_PATH
: options.runtimeInjection
? options.runtimeInjection
: options.dev
? DEFAULT_INJECT_PATH
: undefined,

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:

  1. Using the babel-plugin, pass dev: true and runtimeInjection: false.
  2. 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.

@nmn
Copy link
Contributor

nmn commented Jan 4, 2024

I already have a PR up to fix this. #298

@nmn
Copy link
Contributor

nmn commented Jan 26, 2024

Fixed in 0.5.0

@nmn nmn closed this as completed Jan 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants