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

solid-js is being bundled twice in production and not in dev #112

Open
chiefcll opened this issue Aug 6, 2023 · 4 comments
Open

solid-js is being bundled twice in production and not in dev #112

chiefcll opened this issue Aug 6, 2023 · 4 comments

Comments

@chiefcll
Copy link

chiefcll commented Aug 6, 2023

In dev mode solid-js module is being dedup to ensure its only being bundled once. But when you build for production its not and thus solid-js can be bundled twice leading to side effects like createEffect not having a root because there are two solids running.

I think the solution is to always set dedup and optimizeDeps to the libraries you have listed to prevent them from being bundled twice or be able to pass in dedupe: [...nestedDeps, ...solidPkgsConfig.nestedDeps]

This is related to: solidjs/solid#1843 and is the root cause of that issue.

@chiefcll
Copy link
Author

chiefcll commented Aug 8, 2023

I've had to add

resolve: {
    dedupe: ['solid-js'],
  },

To my vite config to fix the issue. I think this should be dedupe by default...

@ngryman
Copy link

ngryman commented Aug 23, 2023

Thanks @chiefcll 🙏 I lost 1 hour on this...
I think it should be at least mentioned in the docs.

@GitMurf
Copy link

GitMurf commented Aug 30, 2023

Ok I have spent half a day trying to figure out my issue and it seems like maybe this is related! When I am running my unit tests with vitest, whenever I use my main vite config that has the vite-plugin-solid included, it runs my tests twice! Does this make any sense? It seems like too much of a coincidence to not be related? Any ideas on solutions / workarounds as the resolve['dedupe'] does not seem to work for vite plugins (or whatever is causing the duplication). Thanks in advance for any help or ideas!

image

@GitMurf
Copy link

GitMurf commented Sep 12, 2023

When I am running my unit tests with vitest, whenever I use my main vite config that has the vite-plugin-solid included, it runs my tests twice!

FYI see this thread for the solution to my issue mentioned above: #101 (comment)

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

No branches or pull requests

3 participants