-
Notifications
You must be signed in to change notification settings - Fork 2
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
pluggable child apps (multiapp) #30
Comments
Do we really need care of this? IMHO it easier create 2 separate apps with different Nuxt config, packages.json and build/deploy them independently. Otherwise we got big monolith which is hard to maintain. |
@Koc Exactly that's also my concern/preference to use separate projects. But I know monolith projects that may benefit from this feature to structure their project better. Also, we have the possibility to add parts using an NPM package. (Probably |
For sharing some code between apps we can use monorepo approach, extract common business logic/api clients/etc into separate package and require it using path package or npm-link or tools like Rush |
Agree with @Koc concern, we should consider more about this.
In my perspective, I would like leverage
For common app, we already provide
If necessary, it would be better to use module or sth like |
@clarkdo I see your point about route conflicts. that's also mentioned in the notes to be supported About mono-repo yes that's one solution for separating admin/cms I personally use (and also The Purpose of this enhancement is not having different parts (admin/cms/mobile) and not a good practice to use it for that. but splitting the main project into separate and reusable modules. The increasing number of pages for an enterprise project is unavoidable and there is no way to split it into smaller modules. One other point is that client-side routing works across this sub-apps. |
Yes, please! It would be great to have this feature. |
I'd prefer this to losing the state on micro Frontends. Maybe pairing it with some best practices guidelines would make this more resilient |
We've been experimenting this in a PoC at my company. We were able to inject sub-apps routes via Nuxt modules. And were proposing this for one of our products. I love to see we are aligned, @pi0. Given it's a very specific case that most of Nuxt apps are not going to use, I hope it won't affect the size of their bundles. @clarkdo is pointing fair concerns. I think Nuxt core is mature enough to envision this but our current file structure isn't. Therefore a lot of things that come after (in how Nuxt wires up its parts) are coupled with this file structure. Think about backend architectures. For example, the Hexagonal Architecture. If Nuxt core was really a core, it wouldn't care if there are 1 or 2 apps. Or 1 or 2 UI systems. Replying to @clarkdo's points:
|
This keeps coming to my head. If there is no consensus, how about creating a module that |
@pm-LTK This does not affect the user's performance at all. All sub-apps are finally merged into the same data structure. We just glob multiple directories. I also thought about the module, but that module should duplicate most of the logic of |
It would be a VERY GREAT feature, in my case for multi-domains support 🙂 For instance (it is absolutely not for i18n but it's a good understandable example):
It would fit perfectly for:
|
I just stumbled across this after making something similar. https://codesandbox.io/s/my-app-9ythm You set the theme path in the nuxt.config, which essentially could be an environment varible. That enables you to reuse any existing component code via extends. |
We actually ran into something similar as our project got bigger. But we ended up using a monorepo, with several "seperate" nuxt projects, but all the nuxt projects use a shared component library (see a demo how we did that with nuxt: https://github.com/simllll/nuxt-library-demo) and a "module" library where we abstracted all the shared middleware and plugins. Therefore it's only business logic and pages / custom components that are in the nuxt projects. Furthermore one of the sub packages of our mono rep is a cordova mobile app which is using one of the nuxt projects and builds a SPA app out of it. I would prefer keeping the code "stuctured" but "seperated". Which I'm unsure if this is the case if nuxt allows sub-apps. It's just one special use case that is covered with it (think about e.g. a storybook for your components, another cordova app, or something else people can come up with.. ;)) So for us, we have all freedom and all advantages combined with a monorep approach (which is also used in different projects and is commonly used everyhwere around ;)) and still have a very strickt seperation of code and logik, therefore I would vote for a better documentaton or CLI for a monorepo setup (with a component library or other templates in it) instead. |
See nuxt/nuxt#5816 please |
Do you think below articles covers some parts of it? |
I explained at length that this does not cut it for me here: nuxt/nuxt#5816 (comment) |
I go through that I understand that you are looking for something else. Here I'm taking a general opinion the post |
I hope the development team nuxt will be able to offer a solution to this problem. It really is a matter of necessity.. |
Any news on this? |
what about https://podium-lib.io approach? I just create a vue csr podlet (podium) and it works fine, and now I want to create a nuxt podlet, but I'm issues to use podium as a nuxt midleware :( |
This is something that will bring NuxtJS to the next level. I'm working with the same intention trying to see the best solution, having this native would be amazing. |
I have a semi-related use-case that might fall within this RFC, but happy to open a new issue or RFC for discussion if the concepts are different enough. I'm trying to figure out if it's possible to hydrate 2 Nuxt micro-apps on the same page (i.e. a header and a footer when the entire page is not necessarily controlled by Vue/Nuxt). I've made some progress but I still have some more investigation to do into whether I can support this with existing hooks/modules or not. We're currently doing this through a manual Our use-case is a route-by-route migration of a large production site over to Vue SSR. Instead of a big-bang migration from our legacy architecture to Vue, we've been moving route-by-route. We have a small proxy that directs supported routes to the new The legacy server makes a call such as Then in the manual Routing poses an interesting challenge. In our case, we don't have any needs for client-side routing from the header or footer since the legacy app is not a SPA. There's a few potential options here:
I'm curious if this is something that this RFC might enable via Nuxt or that would be en entirely new RFC? So far, I've gotten pretty close in Nuxt with 3 main changes:
So the last part that I'm investigating now is whether I have any access to tap into the hydration internals and hydrate multiple apps while sharing a Vuex store. |
I took a quick stab at the above in nuxt/nuxt#8554. Didn't seem to be able to get to the hydration internals through a module. |
This would be amazing, it's not the first time that a client requested a "monorepo" style project where in the same project he'd like to have the frontend but also an admin dashboard and later on decided that he wanted to deploy it as two separate parts. |
Hi, Did you ever continue with this ? |
Hello guys! Great work so far. Quick question, is this still on the roadmap for Nuxt3? |
@MarioC3 Yes! Part of POC is in nuxt-extend which needs to be ported to nuxt kit + some refactors on nuxt3 core to fulfill requirements. |
@pi0 Awesome! nuxt-extend is great! Again, thanks for all the work! You guys rock! |
@amithcabraal-borngroup Nothing beyond the quick POC in nuxt/nuxt#8554 unfortunately |
It's coming 👀 |
This is my last work for implement this type of feature. |
Background
When the project structure grows, sometimes it is not convenient to use a flat directory structure or keep everything in a single repo.
Why?
srcDir
implemented in Nuxt. This feature needs a small refactor effort and does not makes core complicated.Proposed Solution
One can structure a project like this:
The
shop/
dir should basically follow the same standard nuxt directory structure. Builder module combines all children app to the main one. And also creates aliases so components inside admin can be required using:For registering
admin
app, it should be registered insidenuxt.config
. (Items can be npm packages or local dirs)Limitations
These are problems with current POC. We can progressively enhance this functionality and workaround these limitations.
srcDir
is hardcoded invue-app
templatesadmin/
prefix to store modules and pages) -- children will be registered with the same namespace.template
flag to support and copy the template child apps to the.nuxt
The text was updated successfully, but these errors were encountered: