question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Help with monorepo

See original GitHub issue

hey,

i want to setup a monorepo (lerna) with vite and vue3 and i can´t find any working solutions. The main problem is to consume the local repos in development and benefit from vites fast hot-reloading and all the other sugar it gives to us. I played with optimizeDeps.link and rollup alias but cannot figure out an acceptable setup without hacky parts.

Can anyone please give an example how this is done right?

My folder structure looks like this:

project-root/
    lerna.json
    packages/
        example-ui/
            index.html
            vite.config.ts
            ....
        ui/
            modules/
                common/
                    src/comp.vue
                    package.json
                dashboard/
                    src/dashboard.vue
                    package.json
                .../

THX for the great work!

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:14 (6 by maintainers)

github_iconTop GitHub Comments

13reactions
miguelramoscommented, Jan 16, 2021

RFC

Hello guys, i’m coming to this thread referenced from #1554 where @yyx990803 call my attention to here. Would be great a cli tool to produce multi apps/libs and keep compatibility with vite-cli. Current i’m doing some research and prototyping with vite. Instead of using lerna (nothing against it, pretty good tool) but i would like to enrich vue/vite ecosystem with a tool more or less like nx.dev does to angular. I will leave here a idea spec for further discussion. This approach have some history (long a bit) that what i saw in many companies that follow lerna approach for multi vue apps and most of them regret on that decision.

viteup-spec

5reactions
yyx990803commented, Jan 11, 2021
  1. Make sure you have your local linked packages also listed in your example (vite) package’s dependencies list
  2. If listed, Vite 2 will auto detect linked packages and you shouldn’t need to use optimizeDeps.link
  3. If your ui module packages define entry points to built files in their package.json, you will need to configure an alias in the example project to redirect to their source entry instead.

We should probably provide some documentation for this. /cc @LinusBorg @csr632 @AlexandreBonaventure who I know have been using Vite in monorepos

Read more comments on GitHub >

github_iconTop Results From Across the Web

What is monorepo? (and should you use it?) - Semaphore CI
A monorepo, on the other hand, works as a central hub, a market square where every developer, engineer, tester, and business analyst meet...
Read more >
Benefits and challenges of monorepo development practices
In a single, monolithic repository, also known as a monorepo, you keep all your application and microservice code in the same source code ......
Read more >
Monorepo Explained
Monorepos are hot right now, especially among Web developers. We created this resource to help developers understand what monorepos are , what benefits...
Read more >
11 Great Tools for a Monorepo in 2021 | Bits and Pieces
Workspaces helps with a few issues, making it a great monorepo setup: It sets up a single node_modules without repetitions or cloning dependencies...
Read more >
A Guide to Monorepos for Front-end Code - Toptal
A monorepo or monorepository is a code management and architectural concept whereby you keep all your isolated bits of code inside one super...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found