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

bug: react, vite, production build yields <tagname> #24229

Closed
4 of 6 tasks
milang opened this issue Nov 17, 2021 · 8 comments · Fixed by #24515
Closed
4 of 6 tasks

bug: react, vite, production build yields <tagname> #24229

milang opened this issue Nov 17, 2021 · 8 comments · Fixed by #24515
Labels
package: react @ionic/react package type: bug a confirmed bug report

Comments

@milang
Copy link

milang commented Nov 17, 2021

Prerequisites

Ionic Framework Version

  • v4.x
  • v5.x
  • v6.x

Current Behavior

When using Ionic React version 6, release candidate 2 with ViteJS (latest, version 2.6.14), Ionic application works as expected in development mode. Production (preview) mode, however, causes all ion-... elements to be rendered as tagname, and shadow DOM nodes are missing.

This can be best seen by looking at DOM of a rendered application (see the reproduction repository below). In development mode you can see ion-app, ion-header and ion-content:

DOM in ViteJS development mode

In production mode, the element structure is still there, but ion-... elements are replaced with tagname:

DOM in ViteJS production preview mode

Expected Behavior

Production mode should still render ion-... + shadow DOM elements, otherwise the application is unusable.

Steps to Reproduce

To run the application in development mode (assuming yarn package manager) :

git clone https://github.com/milang/ionic-simplevitejs && cd ionic-simplevitejs
yarn && yarn run dev

To run the application in production preview mode:

yarn run build && yarn run serve

Code Reproduction URL

https://github.com/milang/ionic-simplevitejs

Ionic Info

No response

Additional Information

No response

@ionitron-bot ionitron-bot bot added the triage label Nov 17, 2021
@liamdebeasi
Copy link
Contributor

Thanks! I spoke with the team and the fix appears to be related to something in Stencil: ionic-team/stencil#2959.

@liamdebeasi liamdebeasi changed the title bug: Ionic React v6 doesn't work in ViteJS production mode bug: react, vite, production build yields <tagname> Nov 17, 2021
@liamdebeasi liamdebeasi added package: react @ionic/react package type: bug a confirmed bug report labels Nov 17, 2021
@ionitron-bot ionitron-bot bot removed the triage label Nov 17, 2021
@liamdebeasi liamdebeasi added stencil Issues that require changes in Stencil triage and removed package: react @ionic/react package labels Nov 17, 2021
@ionitron-bot ionitron-bot bot removed the triage label Nov 17, 2021
@iansjk
Copy link

iansjk commented Nov 23, 2021

Is there by chance a workaround for this in the short term? I've read the linked issue and attempted to use the custom resolution

"@stencil/core": "npm:@johnjenkins/stencil-community@^2.5.0"

but without any success (Vite still emits <tagname> in production builds).

@liamdebeasi
Copy link
Contributor

There is no workaround at the moment. We are working closely with the Stencil team to resolve this.

@johnjenkins
Copy link

johnjenkins commented Nov 27, 2021

Sorry to chime in, but this is def not related to ionic-team/stencil#2959 :)
Some weird clash with jsx?

@liamdebeasi
Copy link
Contributor

Not sure, but we are looking at this with the Stencil team to better pinpoint where the issue may be.

@liamdebeasi
Copy link
Contributor

liamdebeasi commented Dec 14, 2021

Hi everyone,

We believe this is a bug in the React plugin for Vite. We have filed an issue with the Vite team: vitejs/vite#6104

I will follow up here when I have more to share. Thanks!

@liamdebeasi
Copy link
Contributor

Thanks for the issue. This has been resolved via #24515, and a fix will be available in an upcoming release of Ionic Framework.

@ionitron-bot
Copy link

ionitron-bot bot commented Feb 4, 2022

Thanks for the issue! This issue is being locked to prevent comments that are not relevant to the original issue. If this is still an issue with the latest version of Ionic, please create a new issue and ensure the template is fully filled out.

@ionitron-bot ionitron-bot bot locked and limited conversation to collaborators Feb 4, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
package: react @ionic/react package type: bug a confirmed bug report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants