You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Text modules (import text from './file.txt' with { type: 'text' }) landed in #62300 behind --experimental-import-text and are documented as Stability 1.0 (Early development). They have shipped in 26.x and were backported to 24.19.0.
The flag makes the feature hard to use in practice. Libraries can't rely on it, because they would have to tell every consumer to pass a CLI flag. #65210 also showed that the flag gate affects userland loaders that handle type: 'text' themselves. #64992 fixed that, but it's a sign that "on behind a flag" and "off" are two separate behaviours that loader authors have to keep in mind.
Standards status:
tc39/proposal-import-text is at Stage 3 (since March 2026).
What is the feature you are proposing to solve the problem?
Remove the flag requirement while keeping the feature experimental, following what was done for JSON modules. JSON modules were unflagged in #41736 (v17.5.0) while import assertions were still Stage 3, and were only marked stable in #55333 after the proposal reached Stage 4.
Concretely:
Stop gating on --experimental-import-text in lib/internal/modules/esm/assert.js and lib/internal/modules/esm/get_format.js.
Keep the existing emitExperimentalWarning('Text import') in the text translator.
Turn --experimental-import-text into a NoOp option, like --experimental-json-modules, so existing scripts keep working.
Move the docs to Stability 1.1 (Active development).
Update the tests: test-esm-import-text-disabled.mjs would need to change or be removed.
Question for @nodejs/loaders: are there open semantics questions (BOM handling, non-UTF-8 sources, the text/plain charset regex in mimeToFormat) that should be settled first?
Activity