forked from vitejs/vite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(worker): rewrite rollup
output.format
with worker.format
on w…
…orker build error (vitejs#18165)
- Loading branch information
Showing
5 changed files
with
49 additions
and
1 deletion.
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
1 change: 1 addition & 0 deletions
1
packages/vite/src/node/__tests__/fixtures/worker-dynamic/dynamic.js
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 @@ | ||
export default 'dynamic ok' |
12 changes: 12 additions & 0 deletions
12
packages/vite/src/node/__tests__/fixtures/worker-dynamic/main.js
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,12 @@ | ||
document.querySelector('#app').innerHTML = ` | ||
<div> | ||
<h1>Test worker</h1> | ||
<div id="worker">???</div> | ||
</div> | ||
` | ||
|
||
const worker = new Worker(new URL('./worker.js', import.meta.url)) | ||
worker.onmessage = (e) => { | ||
document.querySelector('#worker').textContent = e.data | ||
} | ||
worker.postMessage('hi') |
4 changes: 4 additions & 0 deletions
4
packages/vite/src/node/__tests__/fixtures/worker-dynamic/worker.js
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,4 @@ | ||
self.onmessage = async () => { | ||
const mod = await import('./dynamic') | ||
self.postMessage('hello from worker: ' + mod.default) | ||
} |
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