Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix crash when calling
emitFile
for chunks without a name
- Loading branch information
1 parent
32a42ec
commit 0c62f25
Showing
7 changed files
with
55 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'wmr': patch | ||
--- | ||
|
||
Fix crash when calling `emitFile` for chunks without a name |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
<h1>it doesn't work</h1> | ||
<script type="module" src="index.js"></script> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
console.log('hey'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
addEventListener('message', () => { | ||
postMessage('it works'); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
export default function foo() { | ||
return [ | ||
{ | ||
name: 'plugin-a', | ||
async transform(code, id) { | ||
if (!id.endsWith('index.js')) return; | ||
|
||
const chunkRefId = this.emitFile({ | ||
id: 'public/worker.js', | ||
type: 'chunk' | ||
}); | ||
|
||
return { | ||
code: `const url = new URL(import.meta.ROLLUP_FILE_URL_${chunkRefId}, import.meta.url); | ||
const worker = new Worker(url, { type: "module" }); | ||
worker.addEventListener("message", e => { | ||
document.querySelector("h1").textContent = e.data; | ||
}); | ||
worker.postMessage("hello");`, | ||
map: null | ||
}; | ||
} | ||
} | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters