Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

6.0.6出现打包错误 #19081

Closed
7 tasks done
eamd-wq opened this issue Dec 26, 2024 · 3 comments
Closed
7 tasks done

6.0.6出现打包错误 #19081

eamd-wq opened this issue Dec 26, 2024 · 3 comments

Comments

@eamd-wq
Copy link

eamd-wq commented Dec 26, 2024

Describe the bug

我的项目中使用6.0.6,在打包时会出现报错(pure name):1:0: ERROR: Expected identifier but found "debugger"
回退到6.0.5则没有报错了

完整报错信息:

error during build:
[vite:build-html] Transform failed with 1 error:
(pure name):1:0: ERROR: Expected identifier but found "debugger"
file: D:/code/qzk/qzk-admin/index.html:1:0

Expected identifier but found "debugger"
1  |  import './polyfill';
   |  ^
2  |  import { createApp } from 'vue';
3  |  import App from './App.vue';

    at failureErrorWithLog (D:\code\qzk\qzk-admin\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:1476:15)
    at D:\code\qzk\qzk-admin\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:755:50
    at responseCallbacks.<computed> (D:\code\qzk\qzk-admin\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:622:9)
    at handleIncomingPacket (D:\code\qzk\qzk-admin\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:677:12)
    at Socket.readFromStdout (D:\code\qzk\qzk-admin\node_modules\.pnpm\[email protected]\node_modules\esbuild\lib\main.js:600:7)
    at Socket.emit (node:events:518:28)
    at addChunk (node:internal/streams/readable:561:12)
    at readableAddChunkPushByteMode (node:internal/streams/readable:512:3)
    at Readable.push (node:internal/streams/readable:392:5)
    at Pipe.onStreamRead (node:internal/stream_base_commons:189:23)
 ELIFECYCLE  Command failed with exit code 1.

Reproduction

https://github.com/eamd-wq/vite-bug-demo

Steps to reproduce

pnpm i
pnpm build

System Info

Windows 11; node 22;

Used Package Manager

pnpm

Logs

No response

Validations

@eamd-wq
Copy link
Author

eamd-wq commented Dec 26, 2024

也许不用,我看到了 #18737
但是这个问题让我以为是其他包的问题(潜意识里很放心vite),排查了久才开始怀疑vite;

@sapphi-red
Copy link
Member

https://github.com/eamd-wq/vite-bug-demo/blob/9924aca48c87ac304051a8b637552fd79be763bc/vite.config.ts#L144
It seems esbuild 0.24.1+ does not allow debugger to be passed to pure option (esbuild try 0.24.0, esbuild try 0.24.2). Since passing debugger to pure did nothing, I think this is a bug fix rather than a regression.
For debugger, I think drop option should be used.

@sapphi-red sapphi-red closed this as not planned Won't fix, can't repro, duplicate, stale Dec 27, 2024
@eamd-wq
Copy link
Author

eamd-wq commented Dec 28, 2024

是的,我添加了配置:drop: VITE_DROP_CONSOLE === 'true' ? ['debugger'] : [],问题已解决
感谢

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants