Skip to content

Commit f0ae31f

Browse files
committed
fix: initial chunk file crash under rspack
1 parent bc08436 commit f0ae31f

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
# Changelog
22

3+
## 2.1.3
4+
5+
- Fix experimental_output stack overflow
6+
37
## 2.1.2
48

59
- Fix experimental_output with HMR chunks

lib/webpack5/InitialChunkFile.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -209,8 +209,14 @@ function getInitialAndAsyncFiles(compilation, entry) {
209209

210210
/** @param {import('@rspack/core').Chunk | import('webpack').Chunk} chunk */
211211
function visit(chunk) {
212-
if (visitedChunk.has(chunk)) return
213-
visitedChunk.add(chunk)
212+
const chunkId =
213+
'rspack' in compilation.compiler
214+
? !chunk.id || !chunk.hash
215+
? Array.from(chunk.files).join('')
216+
: chunk.id + chunk.hash
217+
: chunk
218+
if (visitedChunk.has(chunkId)) return
219+
visitedChunk.add(chunkId)
214220
chunk.files.forEach((file) => {
215221
if (!isJSFile(file)) return
216222
const asset = compilation.getAsset(file)

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "webpack-target-webextension",
3-
"version": "2.1.2",
3+
"version": "2.1.3",
44
"type": "commonjs",
55
"description": "WebExtension plugin for Webpack. Supports code-splitting and dynamic import.",
66
"keywords": [

0 commit comments

Comments
 (0)