-
Notifications
You must be signed in to change notification settings - Fork 12k
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
@angular/elements host application bootstrap twice after element inclusion #29524
Comments
The component is not displaying because the web component script is not being copied: |
Hi @alan-agius4. I did it manually/using a simple Edit what i'm missing in the config. The file content is not the expected. |
…requests Previously, when an unknown `main.js` file was requested, the system would automatically fall back to serving the default `main.js`. This behavior could cause unexpected issues, such as incorrect resource loading or misleading errors. This fix ensures that only valid `main.js` files are served, preventing unintended fallbacks and improving request handling. Closes angular#29524
…requests Previously, when an unknown `main.js` file was requested, the system would automatically fall back to serving the default `main.js`. This behavior could cause unexpected issues, such as incorrect resource loading or misleading errors. This fix ensures that only valid `main.js` files are served, preventing unintended fallbacks and improving request handling. Closes angular#29524
…requests Previously, when an unknown `main.js` file was requested, the system would automatically fall back to serving the default `main.js`. This behavior could cause unexpected issues, such as incorrect resource loading or misleading errors. This fix ensures that only valid `main.js` files are served, preventing unintended fallbacks and improving request handling. Closes angular#29524
…requests Previously, when an unknown `main.js` file was requested, the system would automatically fall back to serving the default `main.js`. This behavior could cause unexpected issues, such as incorrect resource loading or misleading errors. This fix ensures that only valid `main.js` files are served, preventing unintended fallbacks and improving request handling. Closes #29524 (cherry picked from commit 9a46be8)
Thanks for the fix @alan-agius4 🎉 |
Command
build
Is this a regression?
The previous version in which this bug was not present was
No response
Description
I built one simple web component using
@angular/elements
and the new application builder. Then import the web component inside another angular app.As soon as i call the script inside my component, the component is rendered twice. This make my main.js appear twice in the DOM as script tag. My web components does not appear on the page.
Is there anything i'm missing here? A better result could be archieve using old webpack based builder.
The minimal setup for reproduction can be found here https://github.com/billyjov/angular-elements-demo
For simplicity i just build one app and copy the output into the assets folder of another app.
Minimal Reproduction
1- Create a simple Angular CLI monorepo using the latest version of Angular CLI
ng new my-workspace --no-create-application
2- Add two apps to the monorepo, one main and the other that will be use as web component
cd my-workspace ng generate application my-app
3- Turn one app into web components using
@angular/elements
e.g Adjust the
main.ts
of one app (bootstrap process)4- Build the app and include the output
main.js
into the second app for consumption.5- Check the behavior in the Browser.
Or just pull following minimal reproduction of the in following repository
https://github.com/billyjov/angular-elements-demo
Exception or Error
Your Environment
Anything else relevant?
Browser Chrome & Firefox was used
The text was updated successfully, but these errors were encountered: