Giter Site home page Giter Site logo

Issue building with Vite 5 about react HOT 16 CLOSED

lewiswolf avatar lewiswolf commented on April 28, 2024 3
Issue building with Vite 5

from react.

Comments (16)

yevdyko avatar yevdyko commented on April 28, 2024 1

@jamesrweb I can try updating vite in my personal project that uses it to build the app including the react p5 wrapper, and reproduce the issue if possible. I will let you know tomorrow

from react.

lewiswolf avatar lewiswolf commented on April 28, 2024 1

Thanks for your help everyone

from react.

jamesrweb avatar jamesrweb commented on April 28, 2024

Can you share your vite config for v4.5 and v5?

from react.

lewiswolf avatar lewiswolf commented on April 28, 2024

Sure thing. :)

import react from '@vitejs/plugin-react-swc'
import { defineConfig } from 'vite'
import { compression } from 'vite-plugin-compression2'
import svgr from 'vite-plugin-svgr'

// https://vitejs.dev/config/
export default defineConfig({
	assetsInclude: ['**/*.md'],
	plugins: [
		compression({
			algorithm: 'gzip',
			include: /\.(js|mjs|json|css|svg)$/i,
		}),
		react(),
		svgr(),
	],
})

from react.

RossKlein avatar RossKlein commented on April 28, 2024

I am having the same issue

import { defineConfig } from 'vite'
import react from '@vitejs/plugin-react'

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [react()],
})

from react.

jamesrweb avatar jamesrweb commented on April 28, 2024

@lewiswolf @RossKlein So you're telling me that v4.x vite works fine but v5.x is broken and you didn't change the config between versions or anything? To be honest I haven't looked into v5.x yet myself and I can only think that since its a major version change, perhaps the react plugin hasn't updated yet OR that v5.x introduced breaking changes causing this. It should "just work". I will be making a release tonight or tomorrow but I doubt that will change anything since the repo changes are internal type changes and dependency updates mostly. What do you guys think?

from react.

ZOASR avatar ZOASR commented on April 28, 2024

Having mostly the same issue

error during build:
RollupError: Identifier "r" has already been declared

error happens at the same line

at error ([project-root]/node_modules/rollup/dist/es/shared/parseAst.js:337:30)

from react.

jamesrweb avatar jamesrweb commented on April 28, 2024

@jamesrweb I can try updating vite in my personal project that uses it to build the app including the react p5 wrapper, and reproduce the issue if possible. I will let you know tomorrow

Sounds good @yevdyko, thank you 🙏🏻

from react.

RossKlein avatar RossKlein commented on April 28, 2024

@jamesrweb for me it is acceptable to use 4.5 so I downgraded vite. With no other changes p5 wrapper worked.

from react.

jamesrweb avatar jamesrweb commented on April 28, 2024

@RossKlein @lewiswolf @yevdyko it is definitely a breaking change somewhere from Rollup / Vite. I tested upgrading Vite to v5 for this library and the same issue happens as you get also. I guess it's a "read the docs for your own project" scenario guys!

from react.

RossKlein avatar RossKlein commented on April 28, 2024

@jamesrweb wait sorry, I don’t understand what you mean. Is this something that you can’t fix?

from react.

jamesrweb avatar jamesrweb commented on April 28, 2024

@jamesrweb wait sorry, I don’t understand what you mean. Is this something that you can’t fix?

Exactly, it's a Vite 5 or Rollup breaking change. Not related to this library.

from react.

yevdyko avatar yevdyko commented on April 28, 2024

@lewiswolf I tried to upgrade my app to vite version 5 and got the same rollup build error: rollup/rollup#5259

It looks like they fixed it in rollup version 4.5.1, but it still doesn't work for me and it's definitely not related to this react component

from react.

RossKlein avatar RossKlein commented on April 28, 2024

@yevdyko Use version 4.5.0 it works

from react.

yevdyko avatar yevdyko commented on April 28, 2024

@RossKlein yeah, I meant that there was an attempt to fix the problem in rollup with version 4.5.1, but the previous vite version as 4.5.0 works, that's true

from react.

yevdyko avatar yevdyko commented on April 28, 2024

FYI: I had a successful build with these versions:

  • @vitejs/plugin-react: 4.2.0
  • vite: 5.0.4

from react.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.