diff --git a/.changeset/empty-pillows-bathe.md b/.changeset/empty-pillows-bathe.md new file mode 100644 index 0000000000..06360ff365 --- /dev/null +++ b/.changeset/empty-pillows-bathe.md @@ -0,0 +1,5 @@ +--- +'@ice/rspack-config': patch +--- + +fix: assets rule for rspack diff --git a/packages/rspack-config/src/assetsRule.ts b/packages/rspack-config/src/assetsRule.ts index fa04ea23d7..30e48eee58 100644 --- a/packages/rspack-config/src/assetsRule.ts +++ b/packages/rspack-config/src/assetsRule.ts @@ -2,10 +2,7 @@ import type { Configuration } from '@rspack/core'; const getAssetsRule = () => { const assetsRule = [ - [/\.woff2?$/, { mimetype: 'application/font-woff' }], - [/\.ttf$/, { mimetype: 'application/octet-stream' }], - [/\.eot$/, { mimetype: 'application/vnd.ms-fontobject' }], - [/\.svg$/, { mimetype: 'image/svg+xml' }, false], + [/\.woff2?$/], [/\.ttf$/], [/\.eot$/], [/\.svg$/], [/\.(png|jpg|webp|jpeg|gif)$/i], ]; @@ -21,13 +18,13 @@ const getAssetsRule = () => { return { test, type: 'asset', - parser: { - ...(urlCondition ? { + ...(urlCondition ? { + parser: { dataUrlCondition: { maxSize: 8 * 1024, // 8kb }, - } : {}), - }, + }, + } : {}), ...(typeof ruleOption === 'object' ? ruleOption : {}), }; }) as Configuration['module']['rules']).concat(queryRules);