Vite problem building my application
未关闭
还没有人认领这个 Issue。
bug
infrastructure
P2
- 主要语言
- JavaScript
- 星标
- 18.3k
- 派生
- 2k
- 平均合并
- 2 天 12 小时
- 30 天内合并 PR
- 28
描述
Hi,
I'm using Vue3 with vite to build my web application. I am currently using plotly.js as a dependency and can use it without issues in dev mode. However, when I try to build my application for production, I encounter the following error :
vite build
vite v4.2.1 building for production...
✓ 420 modules transformed.
✓ built in 3.77s
[commonjs--resolver] Unexpected token (10:90) in /node_modules/native-promise-only/lib/npo.src.js
file: /node_modules/plotly.js/lib/index.js:10:90
8: context[name] = context[name] || definition();
9: if (typeof module != "undefined" && module.exports) { module.exports = context[name]; }
10: else if (typeof define == "function" && define.amd) { define(function $AMD$(){ return context[name]; }); }
^
11: })("Promise",typeof global != "undefined" ? global : this,function DEF(){
12: /*jshint validthis:true */
error during build:
SyntaxError: Unexpected token (10:90) in /node_modules/native-promise-only/lib/npo.src.js
at Object.pp$4.raise (file:////node_modules/rollup/dist/es/shared/node-entry.js:20978:13)
at Object.pp$9.unexpected (file:////node_modules/rollup/dist/es/shared/node-entry.js:18279:8)
at Object.pp$9.semicolon (file:////node_modules/rollup/dist/es/shared/node-entry.js:18256:66)
at Object.pp$8.parseExpressionStatement (file:////node_modules/rollup/dist/es/shared/node-entry.js:18739:8)
at Object.pp$8.parseStatement (file:////node_modules/rollup/dist/es/shared/node-entry.js:18472:24)
at Object.pp$8.parseBlock (file:////node_modules/rollup/dist/es/shared/node-entry.js:18755:21)
at Object.pp$8.parseStatement (file:////node_modules/rollup/dist/es/shared/node-entry.js:18437:36)
at Object.pp$8.parseBlock (file:////node_modules/rollup/dist/es/shared/node-entry.js:18755:21)
at Object.pp$8.parseStatement (file:////node_modules/rollup/dist/es/shared/node-entry.js:18437:36)
at Object.pp$8.parseIfStatement (file:////node_modules/rollup/dist/es/shared/node-entry.js:18584:26)
贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
使用报告的 Vue 3、Vite 和 plotly.js 设置重现生产构建,从 vite build 开始。检查 plotly.js/lib/index.js 和 native-promise-only/lib/npo.src.js 中报告的第 10 行语法错误附近的内容。生产构建在没有此 resolver 错误的情况下完成,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- javascript, vite
- 领域
- build-system, data-visualization, frontend
- Issue 类型
- 缺陷
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 活跃度
- 停滞
- 描述清晰度
- 需要澄清
- 新手友好度
- 28/100