react-imported-component icon indicating copy to clipboard operation
react-imported-component copied to clipboard

Vite Support

Open BennyAlex opened this issue 1 year ago • 6 comments

@theKashey Hello,

I want to know how to use this libary with vite? (Without SSR)

Since there is no babel I cant use the babel plugin, so is this libary not working with vite? (And therefore not bundler independent?)

Thanks, have a good day.

BennyAlex avatar Apr 13 '23 08:04 BennyAlex

😃 yeah, independent from a bundler, but not from babel 🤷‍♂️

In any case - babel is not required for anything NOT involving SSR, and you've said you don't have it. The responsibility of babel is to "inline" filenames and might name webpack chunks via magic comments to communicate what was done during SSR and shall be redone on the client. One can easily replicate the same via rollup plugin (especially if rollup plugin can just call a babel one)

So, let me be honest, I never tried imported with Vite. Is it working? Is it not?

theKashey avatar Apr 15 '23 13:04 theKashey

I can try it. Is there any config need than or do I just install the package and use the imports?

BennyAlex avatar Apr 16 '23 14:04 BennyAlex

Just using should be fine. Marks are important only for hydration phase, later they are used only as fallback - https://github.com/theKashey/react-imported-component/blob/master/src/loadable/loadable.ts#L43

theKashey avatar Apr 22 '23 07:04 theKashey

Hey @theKashey. We are using react-imported-component in our app (with Vite bundler) without SSR (clIent side SPA only). Do I need to worry about the warning about no mark found in the browser console?

Screenshot 2024-05-10 at 8 05 16 AM

PawanKolhe avatar May 10 '24 02:05 PawanKolhe

Without SSR marks are not important and I might need to provide a way to suppress this error after hydration as it only creates noise

theKashey avatar May 11 '24 08:05 theKashey

@theKashey Right. The warnings are creating a lot of noise in the console. A way to suppress them would be very helpful.

PawanKolhe avatar May 11 '24 09:05 PawanKolhe