-
-
Notifications
You must be signed in to change notification settings - Fork 6.2k
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
Sourcemap is likely to be incorrect: a plugin (undefined) was used to transform files... #4939
Comments
I also encountered this problem. It seems to be related to the |
I took a look at the provided code repositories, and this problem seems to not only affect vue 2. |
@patak-js @Shinigami92 I just made an attempt. I modified this line of code to vite/packages/vite/src/node/plugins/css.ts Line 245 in 3e3c203
|
I'm not sure if this is related, but in a plugin of mine I set it by default to But this just suppress the warning. It's kinda a "the author disabled it intentionally" 🤔 |
@Shinigami92 The problem now is that if you don't use any external plugins, this warning will be reported, which will make people think that there is a problem with Vite itself. |
i'm not sure Maybe the vue plugins could be updated to handle null? The vite docs mention that null is a possibe return for map: https://vitejs.dev/guide/api-plugin.html#transforming-custom-file-types and rollup api specify map as optional too: https://rollupjs.org/guide/en/#transform |
You mean the code can be changed to |
no, I mean not calling .toJSON() |
I saw that the |
hmm, in that case this line is wrong, as map is a Buffer and not a SourceMap there? vite/packages/vite/src/node/plugins/css.ts Line 642 in 4b90e0f
as the subsequent calls to postcss plugins may expect map to be a buffer still, your solution might actually work, sorry for jumping conclusions from the typings and function name. We should update the typings though and make sure that it is a SourceMap where it's typed as such. |
Thanks. But I found a problem. The Have you ever generated an example project with incorrect sourcemap, such as the "svelte" project you mentioned, let me try it. |
don't have an example for svelte rn, but i'm debugging it directly in vite with |
I checked the code again. The |
Great! I also found out just now that it is of the |
added a PR that works with SourceMapGenerator, unfortunately there are a lot more steps needed to get css sourcemaps working. So i'd be fine with rolling back the initial commit too until we have a plan and implement css sourcemaps. |
Closing with vite@2.5.8, @dominikg Anthony included your revert in https://github.com/vitejs/vite/commits/2.5.x |
Can confirm upgrade to 2.5.8 worked, not messages anymore |
Describe the bug
Something changed between 2.5.6 and 2.5.7 in regards to how
<style>
blocks are processed.I have a feeling that 015290a is the cause because not much else changed in regards to CSS between 2.5.6 and 2.5.7 releases.
I've provided a very minimal repo to reproduce the issue.
Reproduction
https://github.com/bompus/vite-sourcemap-issue
$ npm run build
$ npm install vite@2.5.6
$ npm run build
no warnings / errors
$ npm install vite@2.5.7
$ npm run build
same warning / error appears as above
Edit the App.vue file to change
<style lang="scss">
to<style>
and the warning still appears, but this time it saysa plugin (vite:css) was used
instead ofa plugin (undefined) was used
.System Info
Used Package Manager
npm
Logs
No response
Validations
The text was updated successfully, but these errors were encountered: