File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3604,6 +3604,7 @@ one is included in the list below.
36043604* ` --experimental-detect-module `
36053605* ` --experimental-eventsource `
36063606* ` --experimental-import-meta-resolve `
3607+ * ` --experimental-import-text `
36073608* ` --experimental-json-modules `
36083609* ` --experimental-loader `
36093610* ` --experimental-modules `
Original file line number Diff line number Diff line change @@ -294,8 +294,10 @@ Node.js only supports the `type` attribute, for which it supports the following
294294| Attribute ` type ` | Needed for |
295295| ---------------- | ---------------- |
296296| ` 'json' ` | [ JSON modules] [ ] |
297+ | ` 'text' ` | [ Text modules] [ ] |
297298
298299The ` type: 'json' ` attribute is mandatory when importing JSON modules.
300+ The ` type: 'text' ` attribute is mandatory when importing text modules.
299301
300302## Built-in modules
301303
@@ -709,6 +711,25 @@ exports. A cache entry is created in the CommonJS cache to avoid duplication.
709711The same object is returned in CommonJS if the JSON module has already been
710712imported from the same path.
711713
714+ <i id="esm_experimental_text_modules"></i>
715+
716+ ## Text modules
717+
718+ > Stability: 1.0 - Early development
719+
720+ Text modules are available behind the ` -- experimental- import -text` flag.
721+
722+ Text files can be referenced by ` import` :
723+
724+ ` ` ` js
725+ import message from ' ./message.txt' with { type : 'text ' };
726+ ` ` `
727+
728+ The ` with { type: ' text' }` syntax is mandatory; see [Import Attributes][].
729+
730+ The imported text only exposes a ` default` export whose value is the module
731+ source as a string.
732+
712733<i id="esm_experimental_wasm_modules"></i>
713734
714735## Wasm modules
You can’t perform that action at this time.
0 commit comments