Skip to content

babel-preset: using TypeScript module import in makeStyles call causes build error in Vite #627

Description

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    🥲 wontfixThis will not be worked on

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions