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

fix(emotion): Strip backslashed segments for Windows path #328

Merged
merged 2 commits into from
Jul 5, 2024

Conversation

iryan2
Copy link
Contributor

@iryan2 iryan2 commented Jul 4, 2024

Currently, when @swc/plugin-emotion is used on Windows, it produces invalid CSS class names. Apparently this is an unsolved issue for Rust. In this PR I've updated the calculation of the [filename] labelFormat such that it handles both the Windows path, which includes the full path to the file, including backslashes, and the Unix path (which was working fine to begin with).

I have set up a minimal repo for reproducing the issue and verifying the fix. The issue can be reproduced on the main branch, and the fix can be verified on the fix branch. The fix branch replaces the compiled swc_plugin_emotion.wasm from @swc/plugin-emotion npm package with one I built myself via my fork of this repo.

Before

Screenshot 2024-07-03 at 4 22 41 PM

After

Screenshot 2024-07-04 at 7 07 42 AM

Fixes #327

Copy link

changeset-bot bot commented Jul 4, 2024

🦋 Changeset detected

Latest commit: b1d2e0f

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@swc/plugin-emotion Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@CLAassistant
Copy link

CLAassistant commented Jul 4, 2024

CLA assistant check
All committers have signed the CLA.

@kdy1 kdy1 changed the title plugin-emotion: Strip backslashed segments for Windows path fix(emotion): Strip backslashed segments for Windows path Jul 5, 2024
@kdy1 kdy1 merged commit 7830879 into swc-project:main Jul 5, 2024
6 checks passed
@iryan2 iryan2 deleted the iryan2/fix-emotion-plugin-on-windows branch July 5, 2024 01:23
@kdy1 kdy1 self-assigned this Sep 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

@swc/plugin-emotion breaks styles on Windows
3 participants