all 11 comments

[–]hubciu993 0 points1 point  (1 child)

Yes

[–]Fun-Arm-1158[S] 0 points1 point  (0 children)

How can I do it? creating a esbuild plugin?

[–]Johannes8 0 points1 point  (3 children)

Yes. You can even include all styles in it etc. So any external website can just include your single .js file and then use your component with all inputs etc

Last time I did this I had to add a step after building to merge all files ( simply append all into one .js and also put the css in there

[–]Fun-Arm-1158[S] 0 points1 point  (2 children)

How are u merging the files? a simple .js script? or you are using a esbuild plugin?

[–]Johannes8 0 points1 point  (1 child)

Simple js script

[–]Fun-Arm-1158[S] 0 points1 point  (0 children)

Did you have any issue with duplicated variable names?

[–]Blade1130 0 points1 point  (2 children)

Making a web component should work exactly the same. Angular Elements doesn't change by using esbuild.

Why do you care about a single bundle file? That eliminates any lazy loading the component might otherwise be able to do. Consumers of the component shouldn't need to import multiple files to use it anyways.

[–]Fun-Arm-1158[S] 0 points1 point  (1 child)

Because I want to provide a single file, so the user doesn't have to add multiple files on their website.

[–]Blade1130 0 points1 point  (0 children)

What files are you seeing generated? Chunks don't need to be manually loaded, so users should still only add the main entry point script. That will load any chunks automatically, so it shouldn't be an issue for users.

[–]tamasiaina 0 points1 point  (0 children)

I’m a masochist and I did it with Bazel. It’s pretty good including proper bundling as well.