Skip to content
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

Shoelace 2.6.0 is broken when used with Vue in production build #1487

Closed
podlebar opened this issue Aug 6, 2023 · 6 comments · Fixed by #1485
Closed

Shoelace 2.6.0 is broken when used with Vue in production build #1487

podlebar opened this issue Aug 6, 2023 · 6 comments · Fixed by #1485
Assignees
Labels
bug Things that aren't working right in the library.

Comments

@podlebar
Copy link

podlebar commented Aug 6, 2023

Describe the bug

When following the instructions (https://shoelace.style/frameworks/vue) on the shoelace documentation it only works in dev mode. Production builds are failing as no components are shown.

To Reproduce

clone the repo bellow, yarn install and than yarn build && yarn preview.. see the output on the localhost url... the components are not loaded at all.

There is Output that is logged that could lead to a solution or give a hint what is wrong.

Demo

https://github.com/podlebar/shoelace-fail

Vercel deploy:

https://shoelace-fail.vercel.app/

Env

node -v
v18.16.1

Also our productive app hosted on vercel can not be redeployed as the new build is broken.

@podlebar podlebar added the bug Things that aren't working right in the library. label Aug 6, 2023
@podlebar podlebar changed the title Shoelace is broken when used with Vue in production Shoelace is broken when used with Vue in production build Aug 6, 2023
@podlebar
Copy link
Author

podlebar commented Aug 6, 2023

Version 2.4.0 and 2.5.2 work fine

@podlebar podlebar changed the title Shoelace is broken when used with Vue in production build Shoelace 2.6.0 is broken when used with Vue in production build Aug 6, 2023
@Zozman
Copy link
Contributor

Zozman commented Aug 7, 2023

I also had broken builds with 2.6.0 when used in vanilla JavaScript Webpack production mode and downgrading seems to fix the issue. In my example it seems that styles just aren't applied to Shoelace elements at all such as this example where there is no styling information attached to the :host element for a sl-drawer :

Screenshot 2023-08-06 223052

Meanwhile a 2.5.2 drawer has :host items like these:

Screenshot 2023-08-06 223241

@bauglir
Copy link

bauglir commented Aug 7, 2023

The linked example (and looking at the screenshots as well) don't actually include the actual components, just the regular HTML tags. Note the missing shadow-roots in the element selector on the sl-drawer and the sl-qr-code elements. This suggests the components aren't being defined correctly.

I'd think this is a duplicate of #1479 and should be fixed by #1485, but I haven't dug to deeply into that.

@KonnorRogers
Copy link
Collaborator

@bauglir your assessment is correct. Duplicate of #1479 and fixed in #1485

@podlebar
Copy link
Author

podlebar commented Aug 7, 2023

@bauglir @KonnorRogers
do you mean @Zozman example? because i have the components cherrypicked here: https://github.com/podlebar/shoelace-fail/blob/main/src/App.vue#L13

but as far i understood a patch will be released shortly right?

@bauglir
Copy link

bauglir commented Aug 7, 2023

I meant your example as well @podlebar, it's the same issue. Cherry-picking the components has no impact on this as that ends up pulling in the chunk files referenced in #1450 (comment) through the CDN.

The registration of the components in the CustomElementRegistry gets tree-shaken out for production builds, resulting in the "component" being rendered as a plain HTML tag in your example.

image

If the component would have been properly registered with the CustomElementRegistry, that would have shown a #shadow-root with the shadow DOM of the QR code inside it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Things that aren't working right in the library.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants