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

Failed to build the project with vite.js + rsuite #3535

Open
patrickbrito95 opened this issue Jan 4, 2024 · 2 comments
Open

Failed to build the project with vite.js + rsuite #3535

patrickbrito95 opened this issue Jan 4, 2024 · 2 comments

Comments

@patrickbrito95
Copy link

What version of rsuite are you using?

5.49.0

What version of React are you using?

18.2.0

What version of TypeScript are you using (if any)?

What browser are you using?

Chrome

Describe the Bug

Hey guys. I have a problem building my project with Vite.js + rsuite.

This is the error that appears and causes the build to fail:

image

I checked on the internet that the line of code:

define: { global: 'window' }

If I remove this line of code, the build works perfectly. However, I have my doubts as to whether this is a good practice and whether there would be any problem deleting it in the future.

However, I verified that the vite.js template in the repository does not have this line by default:

image

So, I would like to understand if this problem is directly related to define, or if there is something missing for the build to work without changing vite.config.js.

thanks

Expected Behavior

No response

To Reproduce

No response

@simonguo
Copy link
Member

simonguo commented Jan 10, 2024

Hi @patrickbrito95. rsuite depends on @juggle/resize-observer. If define: { global: 'window' } is configured in vite.config.js, it will probably affect the global defined in @juggle/resize-observer, resulting in compilation failure.

I did not reproduce this problem when using the latest version of Vite. What is the version of Vite you are currently using?

@simonguo
Copy link
Member

vitejs/vite#6295
This is a bug in Vite, which has been fixed in version 5.0.0. vitejs/vite#11151

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants