Skip to content

findIndex break windi preprocessor from point of call #409

Open
@Grymse

Description

@Grymse

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions