Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

【v2.9.0-beta.6】empty less file throw an error #7411

Closed
7 tasks done
tyouzu1 opened this issue Mar 23, 2022 · 2 comments
Closed
7 tasks done

【v2.9.0-beta.6】empty less file throw an error #7411

tyouzu1 opened this issue Mar 23, 2022 · 2 comments

Comments

@tyouzu1
Copy link
Contributor

tyouzu1 commented Mar 23, 2022

Describe the bug

this change
result = await nodeLess.render
Read the less file if it is an empty file,result.map will be undefined,JSON.parse(result.map) will throw an error

here vite/src/node/plugins/css.ts#L1299

$ tsc && vite build
vite v2.9.0-beta.6 building for production...
✓ 583 modules transformed.
[vite:css] Unexpected token u in JSON at position 0
file: /***/index.less
error during build:
SyntaxError: Unexpected token u in JSON at position 0
at JSON.parse ()
at less (/node_modules/vite/dist/node/chunks/dep-7a3b37e3.js:19517:22)
at async compileCSS /node_modules/vite/dist/node/chunks/dep-7a3b37e3.js:19051:34)
at async Object.transform (/node_modules/vite/dist/node/chunks/dep-7a3b37e3.js:18691:55)
at async transform (/node_modules/rollup/dist/shared/rollup.js:21994:16)
at async ModuleLoader.addModuleSource /node_modules/rollup/dist/shared/rollup.js:22220:30)

Reproduction

x

System Info

x

Used Package Manager

yarn

Logs

No response

Validations

tyouzu1 added a commit to tyouzu1/vite that referenced this issue Mar 23, 2022
@tyouzu1
Copy link
Contributor Author

tyouzu1 commented Mar 23, 2022

a pr
#7412

@tyouzu1 tyouzu1 changed the title 【empty less file throw an error】v2.9.0-beta.6 【v2.9.0-beta.6】empty less file throw an error Mar 23, 2022
@patak-dev
Copy link
Member

Fixed by #7412

@github-actions github-actions bot locked and limited conversation to collaborators Apr 7, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants