Replies: 2 comments 7 replies
-
On the barrels import side, difficult to know the issue without a repro. What I can tell you is that I stopped doing barrels imports when switching to Vite, it does very bad with the way Vite does HMR. One because it's very easy to do circular dependencies that triggers full reload, and two because each files look has a lot more dependency that the reality that causes a lot more invalidation that was is needed in reality. For ex, if A, B & C import folder D that export component E and util f, changing f invalidate A, B and C even if it's used only in B (not sure that clear with all these letters.). Happy to help with a repro, but I would advice to stop barrels anyway for faster HMR perf. For the memo/eslint plugin I'm not sure if it's a real issue or not. In practice I never use default export (expect for this plugin for compatibility with the Babel plugin) because it hurts refactor in IDEs and greps plus the whole ESM/cjs issues for non frontend code. |
Beta Was this translation helpful? Give feedback.
-
Hi just curious if there is a plugin for |
Beta Was this translation helpful? Give feedback.
-
Hello,
lately, inside a larger project, I tried switching from the other vite-react-plugin over to this one.
In that project I currently try to improve some things a bit and started implementing barrel files.
They seem to work with the other react-vite-plugin but if I switch to this one and make the same changes (just a tailwindcss change or add a simple div) the whole app gets reloaded.
My barrel files look similar to the following examples:
I added file endings for easier identification
Example 1:
Example 2:
The files inside a folder with a barrel file directly import the needed file and don't use the barrel file to prevent circular dependency.
Am I doing something wrong?
In some occasions even the other react-vite-plugin does a full reload, at that point I think I still have a mistake somewhere.
My second question is dependent on the eslint plugin that gets mentioned in the README.
As soon as I enable the eslint plugin
it says that the following code is not correct and might not work with fast-refresh. So my question is if I use React.memo wrong ?
I know my questions are not directly tight to this repo but it would be really helpful if someone helps me. :)
Beta Was this translation helpful? Give feedback.
All reactions