-
-
Notifications
You must be signed in to change notification settings - Fork 7.1k
Closed
rollup/rollup
#5045Closed
Copy link
Labels
Description
Describe the bug
When a plugin incorrectly transform JS code into invalid JS code, instead of showing the actual parsing error. It makes rollup crash in the error augmentation code.
Seems like an bug shared between rollup and vite. The error augmentation code should use the sourceCode as the last transform. Not the original source code.
> vite build
vite v4.3.9 building for production...
✓ 3 modules transformed.
✓ built in 85ms
[vite:build-import-analysis] Cannot destructure property 'line' of 'locate(...)' as it is undefined.
file: /home/projects/vitejs-vite-5cun7m/counter.js
error during build:
TypeError: Cannot destructure property 'line' of 'locate(...)' as it is undefined.
at augmentCodeLocation (file://file:///home/projects/vitejs-vite-5cun7m/node_modules/rollup/dist/es/shared/node-entry.js:2250:17)
at Object.error (file://file:///home/projects/vitejs-vite-5cun7m/node_modules/rollup/dist/es/shared/node-entry.js:23856:25)
at Object.transform (file://file:///home/projects/vitejs-vite-5cun7m/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:45130:22)
ELIFECYCLE Command failed with exit code 1.
Reproduction
Steps to reproduce
pnpm 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.14.2 - /usr/local/bin/node
Yarn: 1.22.19 - /usr/local/bin/yarn
npm: 9.4.2 - /usr/local/bin/npm
npmPackages:
vite: ^4.3.9 => 4.3.9
Used Package Manager
npm
Logs
> vite build
vite v4.3.9 building for production...
✓ 3 modules transformed.
✓ built in 85ms
[vite:build-import-analysis] Cannot destructure property 'line' of 'locate(...)' as it is undefined.
file: /home/projects/vitejs-vite-5cun7m/counter.js
error during build:
TypeError: Cannot destructure property 'line' of 'locate(...)' as it is undefined.
at augmentCodeLocation (file://file:///home/projects/vitejs-vite-5cun7m/node_modules/rollup/dist/es/shared/node-entry.js:2250:17)
at Object.error (file://file:///home/projects/vitejs-vite-5cun7m/node_modules/rollup/dist/es/shared/node-entry.js:23856:25)
at Object.transform (file://file:///home/projects/vitejs-vite-5cun7m/node_modules/vite/dist/node/chunks/dep-e8f070e8.js:45130:22)
ELIFECYCLE Command failed with exit code 1.
Validations
- Follow our Code of Conduct
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn't already an issue that reports the same bug to avoid creating a duplicate.
- 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.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
- The provided reproduction is a minimal reproducible example of the bug.