Open skeithtan opened 23 hours ago
It looks like babel transform breaks import attributes. I added @babel/plugin-syntax-import-attributes
manually and it's working https://stackblitz.com/edit/vitejs-vite-dhfgvm?file=vite.config.ts
I'm not sure if silently stripping {}
is their intended behavior though (maybe should be hard error?).
UPDATE: reported upstream https://github.com/babel/babel/issues/16975
Describe the bug
Reproduction here: https://stackblitz.com/edit/vitejs-vite-no1xpg?file=src%2FApp.tsx
I am trying to import
json
files, with code like so:But running it with
vite
causes it to crash with this error:Strange enough, in the stacktrace, it shows line 3 and 4 with missing braces like so:
import enUs from "../locales/en-US.json" with type: "json";
even though the actual code has braces like so:{ with type: "json" }
.Using
npm:vite@^5.4.11
npm:react@^18.3.1
npm:@vitejs/plugin-react@^4.3.3
npm:@deno/vite-plugin@^1.0.0
Reproduction
https://stackblitz.com/edit/vitejs-vite-no1xpg?file=src%2FApp.tsx
Steps to reproduce
No response
System Info
Used Package Manager
npm
Logs
Validations