ionic-team / stencil

A toolchain for building scalable, enterprise-ready component systems on top of TypeScript and Web Component standards. Stencil components can be distributed natively to React, Angular, Vue, and traditional web developers from a single, framework-agnostic codebase.
https://stenciljs.com
Other
12.61k stars 791 forks source link

Feature Request: Better Monorepo Support #1877

Open petermikitsh opened 5 years ago

petermikitsh commented 5 years ago

Stencil version:

 @stencil/core@latest

I'm submitting a:

[ ] bug report [x] feature request [ ] support request => Please do not submit support requests here, use one of these channels: https://stencil-worldwide.herokuapp.com/ or https://forum.ionicframework.com/

Current behavior:

Example Repo: https://github.com/petermikitsh/stencil-monorepo

When trying to develop 2 Stencil Component projects as subpackages in a lerna setup, some issues arise.

Project setup: Assume two component libraries, project-a and project-b.

Limitations encountered:

Expected behavior:

Seamless support for monorepos. I should be able to develop multiple component libraries side-by-side with typescript types and hot reloading.

Steps to reproduce:

bitflower commented 4 years ago

This is my solution to the "reload on change" requirement: https://gist.github.com/bitflower/613c19b612ffaf3f3195b12b33316034

It's not pretty or fast but it works for now. I guess it's not enough if you do quick iterations in the consumed project.

bitflower commented 4 years ago

This repo demonstrates additionally how to include a "Util / Commons" kinda package consumed by both Stencil component packages.

https://github.com/bitflower/stencil-lerna

LeeBurton commented 4 years ago

I’m seeing an increase in people using monorepos for complex projects with Lerna, and this is something that I think needs addressing sooner rather than later, to solve it in a clean way :-)

razvangeangu commented 4 years ago

This is my solution to reload on change using parallel and alias for a util library inside stencil using lerna.

https://github.com/razvangeangu/stencil-ds-plugins-demo

bitflower commented 4 years ago

Dup of #2648

Guys, let's consolidate and get this happen. Recently Adam started adding changes to support this. It still doesn't work but I think we are close.

Which "main" ticket should be keep to not spam the issues list?

CC @splitinfinities

bitflower commented 4 years ago

@razvangeangu Can you point to the file using parallel? I found the alias.

splitinfinities commented 3 years ago

Hey there, thank you for the patience getting back to you. The new team is getting started and we're working through the backlog now.

I'd like to understand the current state of the art within the community working with a Monorepo. If you have any tips, tricks, concerns, or questions, please comment what you are bumping into and how/if you hack around it.

cymptom commented 3 years ago

@splitinfinities I don't have any tips and tricks unfortunately, but just wanted to highlight that this is an issue for us, in exactly the way described. Our more complex components depend on library packages that are defined adjacent to our Stencil package in our monorepo. When those library packages are rebuilt, Stencil's dev server does appear to rebuild and refresh, but the changes aren't actually incorporated. To incorporate them, you need to either stop and restart the dev server, or manually kick off a Stencil dev build and refresh the browser.

This has led to much confusion as we've started bringing other developers on to our project. The fact that Stencil does rebuild and refresh the dev server misleads our developers into expecting to find their changes in the browser, and this results in a lot of unnecessary wheel-spinning and misdirected troubleshooting, as you might imagine. I've made efforts to communicate the necessary order of operations for this workflow, but it makes for a tedious process that even I get tripped up on, despite knowing exactly what needs to happen.

bitflower commented 2 years ago

lerna is now maintained by nx https://github.com/lerna/lerna/issues/3121

sawden commented 1 year ago

I'm using Stencil in combination with Turborepo and encountering the same issue when it comes to importing from other workspaces. Stencil still doesn't seem to recognize when a change has been made in an imported package.

In my research, I found the following issues that describe this problem: #1379, #2648, #2587, #1496. Are there any updates or progress regarding Stencil's support for monorepos?

I understand that open source projects like this are a huge effort and that priorities must be balanced. I'm wondering if there are plans to work on this monorepo support issues, or if there are other topics that are currently taking precedence?

Thank you in advance for any updates or advice.

bitflower commented 8 months ago

How do I update @rwaskiewicz ? I added a thumbs up to the OP.

Any news reg. this issue/feature ? Does Stencil 4 still have the same issues then v2 (which I'm still on)?