vite
vite copied to clipboard
[ plugin-legacy ] 页面内import worker 。构建后,chunk或者 assets目录内并没有生成work文件(已定位问题为使用plugin-legacy导致)
Describe the bug
import Worker from '@XXX/worker/down-count?worker';
开发源码
生产报错
开发环境 下正常, 构建后生产环境找不到dow-count.js 并报错。进入dist后,也没有生成down-count相关的chunk
### 2022-07-25 问题已定位,在使用 plugin-legacy 的情况下,会出现上述问题,注释legacy代码,worker正常打包
Reproduction
[email protected]:henry-the-great/vite_worker_bug.git
System Info
System:
OS: Windows 7
Memory: 12GB
Binaries:
Node: 16.3 - C:\Program Files\nodejs\node.EXE
npm: 7.24.2 - C:\Program Files\nodejs\npm.CMD
Browsers:
chorme: 103.0.5060.134
npmPackages:
@vitejs/plugin-vue: ^3.0.1 => 3.0.1
vite: ^3.0.2 => 3.0.2
Used Package Manager
npm
Logs
No response
Validations
- [X] Follow our Code of Conduct
- [X] Read the Contributing Guidelines.
- [X] Read the docs.
- [X] Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- [X] Make sure this is a Vite issue and not a framework-specific issue. For example, if it's a Vue SFC related bug, it should likely be reported to vuejs/core instead.
- [X] Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- [X] The provided reproduction is a minimal reproducible example of the bug.
Hello @dang0705. Please provide a minimal reproduction using a GitHub repository or StackBlitz. Issues marked with need reproduction
will be closed if they have no activity within 3 days.
same issue
It seems it happens with plugin-legacy + worker as you said. Minimal reproduction: https://stackblitz.com/edit/vitejs-vite-nzeh9i?file=package.json