DH
DH
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
I found a solution by adding the following to my build.rollupOptions in vite.config.ts:
rollupOptions: {
external: ["solid-js", "solid-js/web", "solid-js/store"],
output: {
exports: "named",
globals: {
"solid-js": "solid",
"solid-js/web": "solidWeb",
"solid-js/store": "solidStore",
}
},
},
rollupOptions: {
external: ["solid-js", "solid-js/web", "solid-js/store"],
output: {
exports: "named",
globals: {
"solid-js": "solid",
"solid-js/web": "solidWeb",
"solid-js/store": "solidStore",
}
},
},
Hopefully this can help someone else with the same troubles 🙂
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
Alright, thanks anyway. I'll see if I can zero in on exactly what's causing the issue. hopefully its just a bundler misconfiguration and not an issue with solidjs
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
@Emily here's a minimally reproducable version: https://codesandbox.io/p/devbox/practical-vaughan-lwjs4f the main directory is the library containing the screen size logic the example/ directory contains the currently running project first text is the imported signal 2nd line is a component that does the same, but inside the library
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
Yes, but you have all 3 files in the same project. It works fine if everything is in a single project, but that's not the case for me. In my case, I have the screen utils and Vec2 class in 1 library project, and I have that installed on a 2nd example app (the index.tsx and Apps.tsx files are here), which is where the problem occurs.
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
Thanks, I'll probably look into that, but I'm still curious as to what causes the reactivity issue in my scenario in the first place.
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
The full repo is available here, at least for the library. The example app I'm using is not on the repo: https://github.com/LordDeatHunter/nodeflow
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
in the library, in src/index.ts (the entrypoint), I'm exporting everything from my utils dir
export * from "./utils";
export * from "./utils";
and then in the src/utils/index.ts im exporting the screen-utils:
export * from "./screen-utils";
export * from "./screen-utils";
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
As for the exporting, give me a sec...
16 replies
SSolidJS
Created by DH on 10/19/2024 in #support
Losing reactivity when importing a signal from a library that uses SolidJS
I removed parts of the code that I thought were irrelevant to keep the messages shorter. I edited the original message with all the imports added. Vec2 has some more stuff, but none of it should relate to SolidJS.
16 replies