Reproduction link or steps
Import a json which is marked as external:
import test from '/test.json' with { type: "json" };
export default defineConfig({
...,
build: {
rollupOptions: {
external: [/test\.json/]
}
}
})
What is expected?
Externals remain with their original with clause, i.e. import test from '/test.json' with { type: "json" };
What is actually happening?
import test from '/test.json'; is emitted, causing unexpected mime errors
System Info
System:
OS: Linux 6.12 Void
Container: Yes
Shell: 4.3.3 - /usr/bin/fish
Binaries:
Node: 24.12.0 - /usr/sbin/node
pnpm: 10.26.2 - /usr/sbin/pnpm
Browsers:
Firefox: 147.0.2
Firefox Developer Edition: 147.0.2
Any additional comments?
Currently workaround is:
const { default: product_list } = await import('/product_list.json', { with: { type: "json" } });
Reproduction link or steps
Import a json which is marked as external:
What is expected?
Externals remain with their original
withclause, i.e.import test from '/test.json' with { type: "json" };What is actually happening?
import test from '/test.json';is emitted, causing unexpected mime errorsSystem Info
System: OS: Linux 6.12 Void Container: Yes Shell: 4.3.3 - /usr/bin/fish Binaries: Node: 24.12.0 - /usr/sbin/node pnpm: 10.26.2 - /usr/sbin/pnpm Browsers: Firefox: 147.0.2 Firefox Developer Edition: 147.0.2Any additional comments?
Currently workaround is: