Native JSON module imports using import attributes (`with { type: 'json' }`) are now supported natively in browsers, Node, Deno, and Bun — no bundler or build step required. The explicit type declaration removes ambiguity about how the runtime should handle the file, enables standard ESM caching semantics, and follows normal CORS rules. Compared to bundler-based JSON imports (which inline at build time), native JSON modules are fetched at runtime and cached like any ES module. Bundlers still offer advantages like inlining, asset hashing, and code splitting, but for simply importing JSON as a module, the platform has caught up. The import attributes pattern also extends beyond JSON, with CSS module scripts already supported in modern browsers.
Table of contents
Why do we need with { type: "json" } ?What you actually get when you import JSONBundlers vs. native JSON modulesModule cachingDo we still need bundlers for JSON?Why this matters beyond JSON2 Comments
Sort: