Vite: [v.1.0.0-rc.4] RangeError: Invalid count value

Created on 15 Aug 2020  Â·  7Comments  Â·  Source: vitejs/vite

Describe the bug

I'm using vite to build react app and I have a bug when execute vite build. This bug occurred at [email protected], but not [email protected] . And also, the bug didn't occur when I remove styled-components from the project.

Reproduction

https://github.com/wan-nyan-wan/vite-warning-bugs

System Info

Logs

Below is a build log.

$ yarn build      
yarn run v1.22.4
$ tsc --noEmit && vite build
vite v1.0.0-rc.4
â § Building for production...
[vite] warnings while transforming index.09068383.js with esbuild:
The following expression is not returned because of an automatically-inserted semicolon
[vite] error while transforming index.09068383.js with esbuild:
RangeError: Invalid count value
    at String.repeat (<anonymous>)
    at Object.generateCodeFrame (/home/sugerme/web/vite-bug/node_modules/@vue/shared/dist/shared.cjs.js:60:40)
    at printMessage (/home/sugerme/web/vite-bug/node_modules/vite/dist/node/esbuildService.js:108:52)
    at /home/sugerme/web/vite-bug/node_modules/vite/dist/node/esbuildService.js:63:44
    at Array.forEach (<anonymous>)
    at Object.exports.transform (/home/sugerme/web/vite-bug/node_modules/vite/dist/node/esbuildService.js:63:29)
    at async Chunk$1.render (/home/sugerme/web/vite-bug/node_modules/rollup/dist/shared/rollup.js:11227:20)
    at async /home/sugerme/web/vite-bug/node_modules/rollup/dist/shared/rollup.js:12201:40
    at async Promise.all (index 0)
[write] dist/asset/index.09068383.js 0.00kb, brotli: 0.00kb
[write] dist/index.html 0.30kb, brotli: 0.14kb
Build completed in 1.70s.

Done in 4.53s.
pending triage

All 7 comments

This looks like two bugs: one for Vite about pretty-printing warnings with large line numbers, and one for Rollup for an incorrect code transformation. I filed the Rollup bug here: https://github.com/rollup/rollup/issues/3729.

Fixed on Rollup side.

Fixed in vue-next as well (https://github.com/vuejs/vue-next/commit/b14f4a505b343b12be846f2455d461027a51641c), should be gone with next vue-next release.

Tried with vite v1.0.0-rc.4 and the newly released vue v3.0.0-rc.6 and the problem doesn't seem to be solved.

I confirm that the problem does not occur with vite v1.0.0-rc.3 though.

I'm getting this too

    "vite": "1.0.0-rc.3"

works fine

Same here, cannot build with swiper.js

[vite] warnings while transforming index.74698f84.js with esbuild:
Comparison with -0 using the === operator will also match 0
[vite] error while transforming index.74698f84.js with esbuild:
RangeError: Invalid count value

Downgrade to "vite": "1.0.0-rc.3"and boom i can build !

Was this page helpful?
0 / 5 - 0 ratings