Open hanayashiki opened 1 year ago
For anyone encountering this bug, you may get around it with alias "clsx": "clsx/dist/index.js"
which is a cjs file and works both in vite and vite-node.
where should I add this alias ?
where should I add this alias ?
Hi, you should add it here https://vitejs.dev/config/shared-options#resolve-alias
Describe the bug
When importing
clsx
in a typescript file, we have a syntax error reported by node due to usingexport
syntax in a cjs file. I think this is due toclsx.m.js
is not treated by node as an ESM.Reproduction
https://github.com/hanayashiki/vite-node-import-clsx-fixture
System Info
Used Package Manager
yarn
Validations