meteor-vite icon indicating copy to clipboard operation
meteor-vite copied to clipboard

@vitejs/plugin-react can't detect preamble. Something is wrong.

Open mikkelking opened this issue 3 years ago • 2 comments

I have created a project, https://github.com/Back2Dev/vite-react-meteor

The purpose of which is to use vite with Meteor and take advantage of the faster load times.

I hit a problem with this error message:

@vitejs/plugin-react can't detect preamble. Something is wrong. See https://github.com/vitejs/vite-plugin-react/pull/11#discussion_r430879201
    at Hello.jsx:6:1

I found something (related to the same error coming from Cypress) that suggested this in the vite.config.js

export default defineConfig({
  plugins: [
    react({
      // Disabling refresh stops the error, but that's kind of pointless
      // include: "**/*.disabled",
    }),
  ],

Which means that the page now loads, but does not refresh

mikkelking avatar Oct 19 '22 20:10 mikkelking

I can confirm. I got the same issue here: https://github.com/henriquealbert/meteor-vite-react/blob/main/vite.config.js#L6

henriquealbert avatar Nov 28 '22 18:11 henriquealbert

I also got the same issue when trying to use Vite + React.

fredmaiaarantes avatar Dec 06 '22 12:12 fredmaiaarantes