Skip to content

Commit 1ac5bff

Browse files
authored
Name Rspack asset modules as bundles (#97)
1 parent b80df42 commit 1ac5bff

3 files changed

Lines changed: 10 additions & 1 deletion

File tree

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'package-build-stats': patch
3+
---
4+
5+
Support packages that emit asset modules such as JSON, fonts, and images.

src/config/makeRspackConfig.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -198,6 +198,7 @@ export default function makeRspackConfig({
198198
},
199199
output: {
200200
filename: '[name].bundle.js',
201+
assetModuleFilename: '[name].[contenthash:8].bundle[ext]',
201202
webassemblyModuleFilename: '[hash].bundle.wasm',
202203
path: outputPath,
203204
},

tests/fast/makeRspackConfig.test.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { describe, expect, test } from 'vitest'
33
import makeRspackConfig from '../../src/config/makeRspackConfig.js'
44

55
describe('makeRspackConfig', () => {
6-
test('uses the bundle filename convention for WebAssembly modules', () => {
6+
test('uses the bundle filename convention for emitted assets', () => {
77
const config = makeRspackConfig({
88
packageName: 'fixture',
99
entry: '/tmp/index.js',
@@ -14,6 +14,9 @@ describe('makeRspackConfig', () => {
1414
outputPath: '/tmp/output',
1515
})
1616

17+
expect(config.output?.assetModuleFilename).toBe(
18+
'[name].[contenthash:8].bundle[ext]',
19+
)
1720
expect(config.output?.webassemblyModuleFilename).toBe('[hash].bundle.wasm')
1821
})
1922
})

0 commit comments

Comments
 (0)