Skip to content

Commit a713d9f

Browse files
authored
feat: add support for type: 'text' in asset modules (#12457)
* feat: add support for type: 'text' in asset modules Add support for type: 'text' in asset modules by mapping it to 'asset/source'. This allows users to import text files as strings using the type: 'text' syntax. * test: update snapshot
1 parent 8c1025c commit a713d9f

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

packages/rspack/src/config/defaults.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -569,6 +569,10 @@ const applyModuleDefaults = (
569569
{
570570
with: { type: "json" },
571571
type: "json"
572+
},
573+
{
574+
with: { type: "text" },
575+
type: "asset/source"
572576
}
573577
);
574578

tests/rspack-test/configCases/asset-modules/type-text/test.filter.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

tests/rspack-test/defaultsCases/default/base.js

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,12 @@ module.exports = {
180180
type: json,
181181
},
182182
},
183+
Object {
184+
type: asset/source,
185+
with: Object {
186+
type: text,
187+
},
188+
},
183189
],
184190
generator: Object {
185191
json: Object {

0 commit comments

Comments
 (0)