Vite problem building my application
Open
Nobody has claimed this yet.
bug
infrastructure
P2
- Dominant language
- JavaScript
- Stars
- 18.3k
- Forks
- 2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 28
Description
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)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the production build with the reported Vue 3, Vite, and plotly.js setup, starting with vite build. Inspect plotly.js/lib/index.js and native-promise-only/lib/npo.src.js around the reported line 10 syntax error. Done means the production build completes without this resolver error.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, vite
- Domain
- build-system, data-visualization, frontend
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100