← Chrome 155 reference

v155 · javascript · covered on mdn

Import Text (Text Modules)

Text modules let JavaScript import the contents of a text file as a string, using the import-attributes syntax import text from "./file.txt" with { type: "text" } (static or dynamic). The module’s default export is the fetched resource decoded as UTF-8. It is a TC39 Stage 3 proposal championed by Eemeli Aro, integrated into HTML in April 2026, and ships enabled by default in Chrome 155.

this feature is documented on MDN

MDN: import … with (import attributes) — Text Modules

MDN documents type: "text" substantively on its import-attributes reference — a dedicated “Text Modules” subsection with the description (“allows importing a module’s source as a string value”), an example, the loading behaviour (response parsed as UTF-8), plus Specifications and Browser compatibility sections (verified 2026-10-18). gendn doesn’t duplicate that here.

Why gendn doesn't duplicate MDN: this site exists for Chrome features that have no MDN reference yet. When MDN covers a feature completely, the honest page is a pointer to the canonical reference plus the shipping metadata MDN doesn't track — duplicated prose would only drift out of sync.

quick reference

// Static form (the proposal README's example, verbatim)
import text from "path/to/file.txt" with { type: "text" };

// Dynamic form
const { default: text } = await import("./file.txt", {
  with: { type: "text" },
});
Source: tc39/proposal-import-text README (static example verbatim); the dynamic form follows the standard import-attributes with option on import()
The changeA new import-attribute value: with { type: "text" } loads the referenced resource as a module whose default export is the source string (a Synthetic Module Record; the string is the resource decoded as UTF-8). No named exports; no encoding affordance (“No affordance for defining the encoding ought to be given” — the proposal README). Per the HTML integration PR, there is no MIME-type requirement and no well-formedness check on the string
Standards trackTC39 Import Text proposal (Stage 3; champion Eemeli Aro). Host integration merged: whatwg/html #11933 “Add text imports” (merged 2026-04-01), fetch destination "text" via whatwg/fetch #1898, and CSP mapping of the "text" destination to connect-src via w3c/webappsec-csp #794
Chrome statusThe milestone=155 listing files it under “Enabled by default” (fetched 2026-10-18; the listing is authoritative for filing), and webstatus.dev records Chrome 155 (2026-10-06) and Edge 155 (2026-10-08)
MDNimport … with — Text Modules subsection (the canonical reference; also linked from the showcase)
Browser compatibilityNo dedicated BCD file resolved for type: "text" yet (checked javascript/statements/import.json and javascript/operators/import.json on 2026-10-18 — the operators file has no text-modules subfeature), so this row cites the web-features data instead, labelled as such: webstatus.dev text-modules (queried 2026-10-18) — Chrome 155, Edge 155, Firefox 153 (shipped first, 2026-07-21), Safari not yet
Baselinewebstatus.dev text-modules: Limited availability — Safari has not shipped, so it is not Baseline yet
ChromeStatus5191512456560640 — Import Text (Text Modules)
Interactive demosChrome Platform Showcase — Import Text with three concepts, each HEAD-checked 200 on 2026-10-18: import a file, fetch comparison, template runner
Source: MDN import … with, fetched 2026-10-18; chromestatus.com/feature/5191512456560640; TC39 Import Text spec draft; whatwg/html #11933

references