Rspack has built-in support for JSON, and you can import JSON files directly.
{ "foo": "bar" }import json from './example.json'; console.log(json.foo); // "bar"In non-.mjs non-strict ESM files, you can directly import properties from JSON.
{ "foo": "bar" }import { foo } from './example.json'; console.log(foo); // "bar"Rspack supports import attributes, and you can use import attributes to import JSON:
import json from './example.json' with { type: 'json' }; import('./example.json', { with: { type: 'json' } });