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

Error generating CSS sourcemap when using SCSS #9969

Closed
MuTsunTsai opened this issue Jan 2, 2024 · 0 comments
Closed

Error generating CSS sourcemap when using SCSS #9969

MuTsunTsai opened this issue Jan 2, 2024 · 0 comments

Comments

@MuTsunTsai
Copy link

MuTsunTsai commented Jan 2, 2024

Vue version

3.4.3

Link to minimal reproduction

https://stackblitz.com/edit/vitejs-vite-3fervz?file=package.json

Steps to reproduce

Open the minimal repo, and execute npm run build to see the error.

What is expected?

The project should build and create a dist folder, containg a js file, a css file, and their sourcemaps.

What is actually happening?

The following error appear:

[ERROR] "version" is a required argument. [plugin vue]

System Info

No response

Any additional comments?

I've tracked this issue down to its source:

result.map.toJSON
? result.map.toJSON()
: JSON.parse(result.map.toString()),

During execution, result.map is, for some reason, not a JSON object, but a Buffer representing the JSON string. And because toJSON method is actually defined on a Buffer, this part of the code calls toJSON method on the Buffer object, resulting in the wrong format later on.

A quick fix I found would be replacing that part by the following:

!(result.map instanceof Buffer) && result.map.toJSON 
   ? result.map.toJSON() 
   : JSON.parse(result.map.toString()), 

I've made a PR based on this observation, but I'm not totally sure if this is the right way to fix it.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant