New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat(worker): bundle worker emit asset file #6599
Merged
patak-dev
merged 14 commits into
vitejs:main
from
poyoho:fix(worker)/bundle-worker-emit-asset-file
Mar 8, 2022
Merged
Changes from 13 commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
6a180ba
feat: test for worker in wasm
poyoho c8cb155
feat: emit asset file in worker
poyoho d44998e
chore: remove unless code
poyoho b388ac4
feat: nested worker test case
poyoho 99c6a3c
fix: test
poyoho 581c178
feat: rebase
poyoho 378a920
chore: remove chunk handle
poyoho 0a7c7e5
fix: test
poyoho aedbb35
test: chunk in worker
poyoho 9d4af30
feat: id for chunk hash calc
poyoho 6cc3384
feat: dynamic import worker test
poyoho 8aeea43
fix: test
poyoho bc4578c
fix: test
poyoho 6b3480a
chore: remove useless config
poyoho File filter
Filter by extension
Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
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
Binary file not shown.
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,8 @@ | ||
import { defineConfig } from 'vite' | ||
export default defineConfig({ | ||
build: { | ||
// make can no emit light.wasm | ||
// and emit add.wasm | ||
assetsInlineLimit: 80 | ||
} | ||
}) |
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 @@ | ||
import init from './add.wasm' | ||
init().then((exports) => { | ||
// eslint-disable-next-line no-undef | ||
self.postMessage({ result: exports.add(1, 2) }) | ||
}) |
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
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,13 @@ | ||
self.onmessage = (event) => { | ||
if (event.data === 'ping') { | ||
self.postMessage('pong') | ||
} | ||
} | ||
const data = import('./workerImport') | ||
data.then((data) => { | ||
const { mode, msg } = data | ||
self.postMessage({ | ||
mode, | ||
msg | ||
}) | ||
}) |
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,13 @@ | ||
import SubWorker from './sub-worker?worker' | ||
|
||
const subWorker = new SubWorker() | ||
|
||
self.onmessage = (event) => { | ||
if (event.data === 'ping') { | ||
subWorker.postMessage('ping') | ||
} | ||
} | ||
|
||
subWorker.onmessage = (event) => { | ||
self.postMessage(event.data) | ||
} |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this change related to the esbuild issue @poyoho? Should we wait for it before merging this PR?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I open a issues in vite #7179
and open in esbuild too. evanw/esbuild#2089
I think not. I think
chrome60
is not a important unit test.The config may I copy from the issues repo in last time. 🙈
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's uncomment this line if the change isn't needed then? Or remove the line directly?
We can merge it afterwards
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok.