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

findIndex break windi preprocessor from point of call #409

Open
Grymse opened this issue Jan 2, 2022 · 0 comments
Open

findIndex break windi preprocessor from point of call #409

Grymse opened this issue Jan 2, 2022 · 0 comments
Labels
bug Something isn't working pending triage
Milestone

Comments

@Grymse
Copy link

Grymse commented Jan 2, 2022

Describe the bug

Hi.

It seems like Windi stops working when using findIndex in classes with SvelteKit.

Only file in routes is Index.svelte. It contains:

<p class="a {[0].findIndex(i => i === 0) ? 'b' : 'c'}" />
<p class="text-red-500">No work</p>

<style windi:preflights:global windi:safelist:global>
</style>

The first line breaks any attempt at using Windi after that. This means that "No work" will not be in red text color as expected.

Observations:

  • The specific function findIndex(....) seems to cause the bug. Changing it to true, will fix the bug
  • Using standard classes (non-windi) still works (Coloring the text using a self-defined class is fine)
  • Problem only occurs if there is a class outside the brackets. Meaning if we remove class 'a' the bug doesn't appear.
  • Removing class b or c has no impact on the bug.
  • The absense of classes responding to a, b or c in style has no impact.
  • There is no feedback from the compiler nor during runtime. Only through the lack of applied classes.

I reckon it has something to do with the type of function that findIndex is.

REPO: https://github.com/Grymse/windi-css-sveltekit-break

System Info

System:
Windows 11 Pro Preview: Build 22523.1000
Ram: 16,0 GB
Intel(R) Core(TM) i7-8550U CPU @ 1.80GHz
Node v16.13.0
npm v8.3.0

vite: 2.7.10
rollup: 2.62.0
windicss: 3.2.1
Windicss-runtime-dom: 3.0.0
svelte-windicss-preprocess: 4.2.5
postcss: 8.4.5
svelte-kit: 1.0.0-next.212
vite-plugin-svelte: 1.0.0-next.33

Used Package Manager

npm

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working pending triage
Projects
None yet
Development

No branches or pull requests

2 participants