vite
vite copied to clipboard
When UMD and CJS are output at the same time: ERROR: Expected "(" but found "."
Describe the bug
While I build Output error
dist/lib/build/a.js 0.16 kB │ gzip: 0.16 kB
[vite:esbuild-transpile] Transform failed with 1 error:
vite-starter.umd.cjs:7:16: ERROR: Expected "(" but found "."
Expected "(" but found "."
5 | })(this, (function (exports) { 'use strict';
6 |
7 | function index.utilA(name) {
| ^
8 | return 1;
9 | }
✓ built in 296ms
error during build:
Error: Transform failed with 1 error:
Reproduction
https://stackblitz.com/edit/vitejs-vite-jnk7u3?file=src%2F_utils%2Findex.js,src%2Fbuild%2Fa.js,src%2Fbuild%2Fb.js,src%2Fbuild%2Findex.js,vite.config.js&terminal=dev
Steps to reproduce
npm run build
System Info
System:
OS: Linux 5.0 undefined
CPU: (8) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
Memory: 0 Bytes / 0 Bytes
Shell: 1.0 - /bin/jsh
Binaries:
Node: 16.20.0 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
pnpm: 8.6.3 - /usr/local/bin/pnpm
npmPackages:
vite: ^4.4.2 => 4.4.4
Used Package Manager
npm
Logs
✓ 3 modules transformed.
dist/lib/_utils/index.js 0.12 kB │ gzip: 0.13 kB
dist/lib/build/index.js 0.16 kB │ gzip: 0.16 kB
dist/lib/build/a.js 0.16 kB │ gzip: 0.16 kB
[vite:esbuild-transpile] Transform failed with 1 error:
vite-starter.umd.cjs:7:16: ERROR: Expected "(" but found "."
Expected "(" but found "."
5 | })(this, (function () { 'use strict';
6 |
7 | function index.utilA(name) {
| ^
8 | return 1;
9 | }
✓ built in 268ms
error during build:
Error: Transform failed with 1 error:
vite-starter.umd.cjs:7:16: ERROR: Expected "(" but found "."
at failureErrorWithLog (file:///home/projects/vitejs-vite-jnk7u3/node_modules/esbuild/lib/main.js:1636:15)
at eval (file:///home/projects/vitejs-vite-jnk7u3/node_modules/esbuild/lib/main.js:837:29)
at responseCallbacks.<computed> (file:///home/projects/vitejs-vite-jnk7u3/node_modules/esbuild/lib/main.js:693:9)
at handleIncomingPacket (file:///home/projects/vitejs-vite-jnk7u3/node_modules/esbuild/lib/main.js:752:9)
at Socket.readFromStdout (file:///home/projects/vitejs-vite-jnk7u3/node_modules/esbuild/lib/main.js:669:7)
at EventEmitter.emit (https://vitejsvitejnk7u3-xdhe.w-credentialless.staticblitz.com/blitz.c53ab388.js:35:143926)
at addChunk (https://vitejsvitejnk7u3-xdhe.w-credentialless.staticblitz.com/blitz.c53ab388.js:35:541673)
at readableAddChunk (https://vitejsvitejnk7u3-xdhe.w-credentialless.staticblitz.com/blitz.c53ab388.js:35:541377)
at Readable.push (https://vitejsvitejnk7u3-xdhe.w-credentialless.staticblitz.com/blitz.c53ab388.js:35:542061)
at _0x542
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.
你确定入口是正确的吗?条目:'./packages/index.ts'
lib.entry Seems to be covered by rollupOptions.input
my project has the same problem, help~
@xyx650 a bug for rollup issue
anyone solved this issue ? I have same problem
anyone solved this issue ? I have same problem
error during build: Error: [vite:esbuild-transpile] Transform failed with 1 error: index.js:8:13: ERROR: Expected ";" but found "."
Expected ";" but found "."
6 |
7 | const numericProp = [Number, String];
8 | const props.makeNumericProp = (defaultVal) => ({
| ^
9 | type: numericProp,
10 | default: defaultVal || 0
at failureErrorWithLog (/Users/huazi/MyCode/kylin-design/node_modules/.pnpm/[email protected]/node_modules/esbuild/lib/main.js:1651:15)
你确定入口是正确的吗?条目:'./packages/index.ts'