File tree Expand file tree Collapse file tree 1 file changed +12
-3
lines changed
packages/vite/src/node/plugins Expand file tree Collapse file tree 1 file changed +12
-3
lines changed Original file line number Diff line number Diff line change @@ -165,10 +165,19 @@ export async function workerFileToUrl(
165
165
export function webWorkerPostPlugin ( ) : Plugin {
166
166
return {
167
167
name : 'vite:worker-post' ,
168
- resolveImportMeta ( property , { chunkId , format } ) {
168
+ resolveImportMeta ( property , { format } ) {
169
169
// document is undefined in the worker, so we need to avoid it in iife
170
- if ( property === 'url' && format === 'iife' ) {
171
- return 'self.location.href'
170
+ if ( format === 'iife' ) {
171
+ // compiling import.meta
172
+ if ( ! property ) {
173
+ return `{
174
+ url: self.location.href
175
+ }`
176
+ }
177
+ // compiling import.meta.url
178
+ if ( property === 'url' ) {
179
+ return 'self.location.href'
180
+ }
172
181
}
173
182
174
183
return null
You can’t perform that action at this time.
0 commit comments