buttons / react-github-btn

:octocat: Unofficial github:button component for React.js
https://buttons.github.io
BSD 2-Clause "Simplified" License
62 stars 8 forks source link

It not works in Vitejs #22

Closed guguji5 closed 2 years ago

guguji5 commented 2 years ago

it works at vite development mode, but throw error in production mode

image image

I guess it can't find the import function

ntkme commented 2 years ago

You probably need https://github.com/vite-plugin/vite-plugin-dynamic-import

ntkme commented 2 years ago

And if it works in dev mode but not production mode, then it seems to be a vite problem.

guguji5 commented 2 years ago

You probably need https://github.com/vite-plugin/vite-plugin-dynamic-import

Thank you for your quick reply, I try this plugin, it still has error as before. as the document said "Dynamic import is not well supported in Vite" I am confused that I don't see require function is called, but it throws error

Finally, I draw a button according your style. fetch the star number and render. https://github.com/n9e/fe-v5/commit/ff1ace4253db80c411d833707a1ae424e6f0bfc5