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

plugin-react 1.0.6 triggers sourcemap and deoptimisation error/warning messages in dev server #5438

Closed
7 tasks done
lucsky opened this issue Oct 27, 2021 · 27 comments · Fixed by #5587
Closed
7 tasks done
Labels
pending triage regression The issue only appears after a new release

Comments

@lucsky
Copy link

lucsky commented Oct 27, 2021

Describe the bug

In a Vite+React project using version 1.0.6 of plugin-react, running yarn run vite serve and then accessing the server triggers a bunch of the following error messages:

Sourcemap for "/Users/luc/Code/myproj/node_modules/.vite/react-dom.js" points to missing source files
Sourcemap for "/Users/luc/Code/myproj/node_modules/.vite/react.js" points to missing source files
Sourcemap for "/Users/luc/Code/myprojvite/react-router-dom.js" points to missing source files
(... and more)

Reproduction

yarn create vite --template react test
cd test
yarn install
yarn run vite serve --open

This will trigger the following messages for me, when doing this in my Desktop folder:

[BABEL] Note: The code generator has deoptimised the styling of /Users/luc/Desktop/test/node_modules/.vite/react-dom.js?v=5ffcdbe8 as it exceeds the max of 500KB.
Sourcemap for "/Users/luc/Desktop/test/node_modules/.vite/react.js" points to missing source files
Sourcemap for "/Users/luc/Desktop/test/node_modules/.vite/react_jsx-dev-runtime.js" points to missing source files
Sourcemap for "/Users/luc/Desktop/test/node_modules/.vite/react-dom.js" points to missing source files

Forcing use of version 1.0.5 of plugin-react "fixes" the error messages:

yarn add --dev @vitejs/plugin-react@1.0.5

System Info

System:
    OS: macOS 12.0.1
    CPU: (8) x64 Intel(R) Core(TM) i7-7700K CPU @ 4.20GHz
    Memory: 1015.09 MB / 32.00 GB
    Shell: 3.3.1 - /usr/local/bin/fish
  Binaries:
    Node: 17.0.1 - /usr/local/bin/node
    Yarn: 1.22.17 - /usr/local/bin/yarn
    npm: 8.1.0 - /usr/local/bin/npm
  Browsers:
    Chrome: 95.0.4638.54
    Firefox: 93.0
    Firefox Developer Edition: 90.0
    Safari: 15.1
    Safari Technology Preview: 15.4
  npmPackages:
    @vitejs/plugin-react: ^1.0.0 => 1.0.6
    vite: ^2.6.4 => 2.6.12

Used Package Manager

yarn

Logs

No response

Validations

@lucsky lucsky changed the title plugin-react 1.0.6 upgrade triggers sourcemap error/warning messages in dev server plugin-react 1.0.6 upgrade triggers sourcemap and deoptimisation error/warning messages in dev server Oct 27, 2021
@lucsky lucsky changed the title plugin-react 1.0.6 upgrade triggers sourcemap and deoptimisation error/warning messages in dev server plugin-react 1.0.6 triggers sourcemap and deoptimisation error/warning messages in dev server Oct 27, 2021
@0xS4D
Copy link

0xS4D commented Oct 27, 2021

Same error here! :(

@mattixittam
Copy link

Seems to be fixed in this commit: 8556ffe

Not released yet though.

@scott-lc
Copy link

scott-lc commented Oct 28, 2021

Still getting this same error w/ vite 2.6.13 + @vitejs/plugin-react 1.0.7 on a branch new, default Vite react-js app.

Sourcemap for "/private/tmp/test/node_modules/.vite/react.js" points to missing source files

With DEBUG="vite:sourcemap" npx vite

Sourcemap for "/private/tmp/test/node_modules/.vite/react.js" points to missing source files
  vite:sourcemap Missing sources:
  vite:sourcemap   /private/tmp/test/node_modules/.vite/dep:react +0ms
Sourcemap for "/private/tmp/test/node_modules/.vite/react_jsx-dev-runtime.js" points to missing source files
  vite:sourcemap Missing sources:
  vite:sourcemap   /private/tmp/test/node_modules/.vite/dep:react_jsx-dev-runtime +869ms
Sourcemap for "/private/tmp/test/node_modules/.vite/react-dom.js" points to missing source files
  vite:sourcemap Missing sources:
  vite:sourcemap   /private/tmp/test/node_modules/.vite/dep:react-dom +6ms

#5458

@uipoet
Copy link

uipoet commented Oct 28, 2021

Both 1.0.6 and 1.0.7 contain this regression.

@Shinigami92 Shinigami92 added the regression The issue only appears after a new release label Oct 28, 2021
@runia1
Copy link

runia1 commented Oct 29, 2021

Can confirm 1.0.7 still has this issue

@NazimHAli
Copy link

+1 can confirm 1.0.7 has it as well.

@jacksteamdev
Copy link

jacksteamdev commented Nov 1, 2021

Seems to be fixed in this commit: 8556ffe

8556ffe was released in 1.1.0-beta.0, but this issue is still present

@ClarkXia
Copy link

ClarkXia commented Nov 2, 2021

deoptimisation message cause by transform files which is larger than 500KB, it should be a way for developers to config rules of exclude babel transform when using plugin-react.

@Mark24Code
Copy link

Mark24Code commented Nov 3, 2021

I met same issues

    "@vitejs/plugin-react": "^1.0.7",
    "vite": "^2.6.13",

Not fixed

Sourcemap for "<**USER_PROJECT_PATH**>/node_modules/.vite/react.js" points to missing source files
Sourcemap for "<**USER_PROJECT_PATH**>/node_modules/.vite/react-dom.js" points to missing source files
Sourcemap for "<**USER_PROJECT_PATH**>/node_modules/.vite/react_jsx-dev-runtime.js" points to missing source files
Sourcemap for "<**USER_PROJECT_PATH**>/node_modules/.vite/prop-types.js" points to missing source files
[BABEL] Note: The code generator has deoptimised the styling of <**USER_PROJECT_PATH**>/node_modules/.vite/chunk-U3O7RQT4.js?v=a89d0a80 as it exceeds the max of 500KB.
[BABEL] Note: The code generator has deoptimised the styling of <**USER_PROJECT_PATH**>/node_modules/.vite/draft-js.js?v=a89d0a80 as it exceeds the max of 500KB.
Sourcemap for "<**USER_PROJECT_PATH**>/node_modules/.vite/draft-js.js" points to missing source files

@danieltkach
Copy link

What's the solution?

@Niputi
Copy link
Contributor

Niputi commented Nov 3, 2021

please pin to version 1.0.5 and wait with upgrade until issue have been closed

@danieltkach
Copy link

please pin to version 1.0.5 and wait with upgrade until issue have been closed

How do I do this?

@andy-law
Copy link

andy-law commented Nov 3, 2021

@danieltkach Just change the dependency in your package.json from e.g. "@vitejs/plugin-react": "^1.0.0" to "@vitejs/plugin-react": "1.0.5" (remove the ^ and set it to a fixed version)

@rwieruch
Copy link

rwieruch commented Nov 5, 2021

FYI: I removed node_module and yarn.lock, reinstalled everything with the pinned version 1.0.5, but still see these Sourcemap warnings.

My Vite dependencies are:

"vite": "^2.6.13",
"vite-plugin-svgr": "^0.4.0",
"@vitejs/plugin-react": "1.0.5

@andy-law
Copy link

andy-law commented Nov 5, 2021

@rwieruch which version of @vitejs/plugin-react do you see in you yarn.lock file? Is it possible that yarn somehow installed a cached version? Might be worth trying the same again but also run yarn cache clean before yarn (of course it shouldn't do this as you've locked the version, but just wondering if it's something along those lines)

@kulothunganug
Copy link

Me too encountering this, Is this is a serious issue?

@sanyuan0704
Copy link
Contributor

This problem has troubled me for a week, and now I finally find the cause!

@sanyuan0704
Copy link
Contributor

I will create a pull request to solve it right away.

@sanyuan0704
Copy link
Contributor

What's the solution?

Now i commit the solution. #5563

@templeman15
Copy link

@danieltkach Just change the dependency in your package.json from e.g. "@vitejs/plugin-react": "^1.0.0" to "@vitejs/plugin-react": "1.0.5" (remove the ^ and set it to a fixed version)

I have done this, deleted node_modules/.vite/ and can verify @vitejs/plugin-react@1.0.4 in yarn.lock. I'm still getting the same exact sourcemap warnings and babel deoptimized style warnings. Has anyone been successful by doing this?

@memark
Copy link

memark commented Nov 9, 2021

@templeman15 Please try using 1.0.5 (not .4) as instructed above.

@templeman15
Copy link

@templeman15 Please try using 1.0.5 (not .4) as instructed above.

@memark im using vite-preset-react which only has a v2.0.0 that has a dependency of 1.0.4. Even if I explicitly add 1.0.5 to my package.json file it is still adding 1.0.4 through vite-preset-react. I'll try one more time in the morning. Thanks!

@memark
Copy link

memark commented Nov 9, 2021

@templeman15 I see. That's a (common) problem. Here is some discussion about the general case:
https://stackoverflow.com/questions/15806152/how-do-i-override-nested-npm-dependency-versions

More specifically here, you might want to ask the author of vite-preset-react to use 1.0.5 and link to this issue.
Or perhaps stop using that plugin (IMHO it doesn't add much you can't configure yourself with a few lines of code).

@templeman15
Copy link

More specifically here, you might want to ask the author of vite-preset-react to use 1.0.5 and link to this issue. Or perhaps stop using that plugin (IMHO it doesn't add much you can't configure yourself with a few lines of code).

@memark thank you for writing back. I was able to do this through yarn with Selective dependency resolution

I just added this to package.json:

 "resolutions": {
    "@vitejs/plugin-react": "1.0.5"
  },

yarn install

And everything works perfect. I'm not sure why we're using vite-preset-react, I'll look into removing it!

@rwieruch
Copy link

@rwieruch which version of @vitejs/plugin-react do you see in you yarn.lock file? Is it possible that yarn somehow installed a cached version? Might be worth trying the same again but also run yarn cache clean before yarn (of course it shouldn't do this as you've locked the version, but just wondering if it's something along those lines)

  • we do not use vite-preset-react (just to make sure, because it was mentioned somewhere else)
  • in the package.json it says: "@vitejs/plugin-react": "1.0.5",
  • in the yarn.lock it says:
"@vitejs/plugin-react@1.0.5":
  version "1.0.5"
  resolved "https://registry.yarnpkg.com/@vitejs/plugin-react/-/plugin-react-1.0.5.tgz#8da501137078c8cb791cf2611f23de7b96ad5494"
  integrity sha512-n92p2fMlo0FZED+y5WYt+tM1mnQsVxcjZ8HuTJhv9gU/nW2zHwEoCemU78Az0KvF+bgafv2AdU4VEnP24bppvw==
  dependencies:

When I start the project, I still get the source map warnings. Since these are just warnings and the project runs without problems, I kept it like this for now.

@rwieruch
Copy link

Can confirm that the warnings go away with "@vitejs/plugin-react": "1.0.8",

Thanks @patak-js 🚀 👍🏽

@memark
Copy link

memark commented Nov 12, 2021

@rwieruch The bug has been fixed. Upgrade to 1.0.8 and it should go away.

IanVS added a commit to storybookjs/builder-vite that referenced this issue Nov 17, 2021
Fixes #129 

Updating the version of `@vitejs/plugin-react` removes the warnings about missing source files.  See vitejs/vite#5438 (comment).

I also was seeing these warnings, and updating made them disappear.
@github-actions github-actions bot locked and limited conversation to collaborators Nov 27, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
pending triage regression The issue only appears after a new release
Projects
None yet
Development

Successfully merging a pull request may close this issue.