ZachJW34 / nx-plus

Collection of Nx Community Plugins
MIT License
300 stars 52 forks source link

Support for Webcomponent #130

Open sforner405 opened 3 years ago

sforner405 commented 3 years ago

Description

Support Vue CLI's web component generation, so the built artifacts can be integrated as web components.

Motivation

Many apps want to share components as web components and do want to integrate them, as they are framework agnostic. To be able to do that easily a type web component would be great.

Suggested Implementation

The Vue Cli already provides a target for it. It seems that all is similar to the library builder, but the target should be wc instead of lib. One way could be to implement a whole new type webcomponent, another to enhance the lib type so a option can be provided for setting the target.

eibhlinniccolla commented 3 years ago

I would also like support for this. We're working on deploying web components for framework agnostic consumption and using vue to generate them. We already use Nx for other things, would be nice to use it for this too.

ZachJW34 commented 3 years ago

If any of y'all are interested in contributing toward this feature, the relevant code for this feature can be found here. Like @sforner405 said we currently lock the target to lib, but we could surface this as a configuration option so as to include wc.

sforner405 commented 3 years ago

Can try to support, but will take some time. Maybe adding storybook support too.

JohannesHoppe commented 3 years ago

In the meantime, has anyone found a workaround?

sforner405 commented 3 years ago

@JohannesHoppe: Right now we use https://github.com/karol-f/vue-custom-element

JohannesHoppe commented 3 years ago

But then you are using directly the Vue CLI, right?

sforner405 commented 3 years ago

No just standard vue lib from the plugin

CrVnsh commented 3 years ago

@sforner405 would be nice if you could share an example of your workaround.