Snowpack monorepo #2536
edmulraney
started this conversation in
Show and tell
Replies: 2 comments 7 replies
-
I've tried building a similar monorepo and faced the same issue. I've also created a repo to reproduce this issue even without monorepo approach - https://github.com/simonchuryakov/snowpack-external-modules-issue Snowpack requires to have at least 1 dependency to be bundled in |
Beta Was this translation helpful? Give feedback.
7 replies
-
I have a minimal monorepo structure, but it works with an older Snowpack version |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I couldn't find much literature on Snowpack monorepos so had a go at setting one up using Yarn workspaces, Typescript, and React with Fast refresh.
I wanted a monorepo with three packages:
components
- a UI component librarylaunch-kit
- a "framework" which usescomponents
app
- an application which uses thelaunch-kit
frameworki.e.
app -> launch-kit -> components
app
is the entry pointThe monorepo needed to have:
app
even if the code change comes fromcomponents
(which isn't a direct dependency ofapp
).The following repo has this all working: https://github.com/edmulraney/snowpack-monorepo
This screenshot shows HMR updates coming from the different packages while the countdown timer state is preserved.
To enable this I had to make these changes:
app
package: addmount
entries for each other monorepo package (used either directly or indirectly inapp
)app
package: add analias
for each other monorepo packageI believe I found a bug in Snowpack while building this. If you make your
package.json
dependencies external (using snowpackpackageOptions.external
), Snowpack fails to build. I've raised a bug for this here: #2560Other than that, everything else is working well across the monorepo, including TypeScript, which is really great to see :)
Has anyone else tried building something similar? Is there something I'm missing with this approach? Is there a better approach?
Beta Was this translation helpful? Give feedback.
All reactions