vite: plugin-react 1.0.6 triggers sourcemap and deoptimisation error/warning messages in dev server

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

About this issue

  • Original URL
  • State: closed
  • Created 3 years ago
  • Reactions: 18
  • Comments: 27 (4 by maintainers)

Commits related to this issue

Most upvoted comments

Can confirm 1.0.7 still has this issue

@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)

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

Seems to be fixed in this commit: 8556ffe

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

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

Thanks @patak-js 🚀 👍🏽

@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).

Same error here! 😦