You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Vite will replace `__filename`, `__dirname`, and `import.meta.url` in **CommonJS** and **TypeScript** config files. Using these as variable names will result in an error:
Copy file name to clipboardExpand all lines: guide/features.md
+7-15
Original file line number
Diff line number
Diff line change
@@ -352,29 +352,25 @@ init({
352
352
353
353
## Web Worker {#web-workers}
354
354
355
-
<<<<<<< HEAD
356
-
一个 web worker 脚本可以直接通过添加一个 `?worker` 或 `?sharedworker` 查询参数来导入。默认导出一个自定义的 worker 构造器:
357
-
=======
358
-
### Import with Constructors
355
+
### 通过构造器导入 {#import-with-constructors}
359
356
360
-
A web worker script can be imported using [`new Worker()`](https://developer.mozilla.org/en-US/docs/Web/API/Worker/Worker)and[`new SharedWorker()`](https://developer.mozilla.org/en-US/docs/Web/API/SharedWorker/SharedWorker). Compared to the worker suffixes, this syntax leans closer to the standards and is the **recommended**way to create workers.
A web worker script can be directly imported by appending `?worker` or `?sharedworker` to the import request. The default export will be a custom worker constructor:
377
-
>>>>>>> 6b06d03e15eb053c88fc505b291dd7a5b3d6798d
373
+
你可以在导入请求上添加 `?worker` 或 `?sharedworker` 查询参数来直接导入一个 web worker 脚本。默认导出会是一个自定义 worker 的构造函数:
0 commit comments