nx-plus icon indicating copy to clipboard operation
nx-plus copied to clipboard

Support for Webcomponent

Open sforner405 opened this issue 3 years ago • 8 comments

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.

sforner405 avatar Dec 09 '20 22:12 sforner405

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.

eibhlinniccolla avatar Dec 11 '20 20:12 eibhlinniccolla

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.

ZachJW34 avatar Dec 16 '20 16:12 ZachJW34

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

sforner405 avatar Dec 23 '20 08:12 sforner405

In the meantime, has anyone found a workaround?

JohannesHoppe avatar Jan 20 '21 20:01 JohannesHoppe

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

sforner405 avatar Jan 21 '21 13:01 sforner405

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

JohannesHoppe avatar Jan 21 '21 13:01 JohannesHoppe

No just standard vue lib from the plugin

sforner405 avatar Feb 15 '21 16:02 sforner405

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

CrVnsh avatar Apr 20 '21 18:04 CrVnsh