Skip to content

Using TypeScript module import in makeStyles call causes Vite build error #627

@tobz1000

Description

@tobz1000

If I import value from a TS module, which includes non-JS syntax (typedefs etc.), and use it within makeStyles, the vite build command will fail with an error like:

error during build:
[wyw-in-js] /src/mod.ts: Missing initializer in const declaration. (3:17)

  1 | export const HEIGHT0 = "100px";
  2 |
> 3 | const _some_value: number = 0;
    |                  ^
  4 |

It looks like the plugin attempts to parse the imported module as plain JS.

Using values from the same module as the makeStyles call will not cause a failure, nor will importing a value from a module which is plain JS syntax.

Demo repo: https://github.com/tobz1000/griffel-627-repro

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions