mirror of
https://github.com/vitejs/vite.git
synced 2024-11-22 07:09:05 +00:00
570e0f1852
Signed-off-by: Jay Wang <jay@zijie.wang> Co-authored-by: 翠 / green <green@sapphi.red>
34 lines
698 B
TypeScript
34 lines
698 B
TypeScript
import { msg as msgFromDep } from '@vitejs/test-dep-to-optimize'
|
|
import { mode, msg } from './modules/workerImport.js'
|
|
import { bundleWithPlugin } from './modules/test-plugin'
|
|
import viteSvg from './vite.svg'
|
|
const metaUrl = import.meta.url
|
|
|
|
self.onmessage = (e) => {
|
|
if (e.data === 'ping') {
|
|
self.postMessage({ msg, mode, bundleWithPlugin, viteSvg, metaUrl, name })
|
|
}
|
|
if (e.data === 'ping-unicode') {
|
|
self.postMessage({
|
|
msg: '•pong•',
|
|
mode,
|
|
bundleWithPlugin,
|
|
viteSvg,
|
|
metaUrl,
|
|
name,
|
|
})
|
|
}
|
|
}
|
|
self.postMessage({
|
|
msg,
|
|
mode,
|
|
bundleWithPlugin,
|
|
msgFromDep,
|
|
viteSvg,
|
|
metaUrl,
|
|
name,
|
|
})
|
|
|
|
// for sourcemap
|
|
console.log('my-worker.js')
|