forked from vitejs/vite
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmy-worker.ts
More file actions
44 lines (42 loc) · 826 Bytes
/
my-worker.ts
File metadata and controls
44 lines (42 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import { msg as msgFromDep } from '@vitejs/test-dep-to-optimize'
import depCjs from '@vitejs/test-worker-dep-cjs'
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,
depCjs,
})
}
if (e.data === 'ping-unicode') {
self.postMessage({
msg: '•pong•',
mode,
bundleWithPlugin,
viteSvg,
metaUrl,
name,
depCjs,
})
}
}
self.postMessage({
msg,
mode,
bundleWithPlugin,
msgFromDep,
viteSvg,
metaUrl,
name,
depCjs,
})
// for sourcemap
console.log('my-worker.js')