single-spa-angular icon indicating copy to clipboard operation
single-spa-angular copied to clipboard

system as default libraryTarget

Open daniloesk opened this issue 5 years ago • 5 comments

Description of Proposed Feature

single-spa documentation recommends using system as default libraryTarget and using it seems to work, at least with latest Angular and single-spa versions. systemjs-webpack-interop also complains if it is not set as system.

Can it be used as default value on ng add single-spa-angular instead of umd? I read somewhere on single-spa documentation that may be some compatibility issues with older... webpack versions?

In what way would you use it?

ng add single-spa-angular

daniloesk avatar Dec 03 '20 12:12 daniloesk

I've considered making this change as well, in the past. The create-single-spa CLI uses libraryTarget of system as it's default for root configs, react applications, and utility modules. The vue-cli-plugin-single-spa project sets the libraryTarget to UMD.

Much of the single-spa community uses SystemJS, but not all of it. I think I'm open to making systemjs the default - the question though is whether it would need to be a new major version or not. For those not using systemjs, this would cause their code to stop working, so i think that it would have to be a major.

internettrans avatar Dec 04 '20 18:12 internettrans

It would affect new projects, but since there may be scripts to create new projects it really looks like a major.

daniloesk avatar Dec 07 '20 10:12 daniloesk

I'm open to adding this in our next major. There are no plans right now for a new major version, and it gets tricky because single-spa-angular@3 serves Angular 1-8 apps, and to make a breaking change we can't bump to single-spa-angular@4 since that's already taken. We can work around that by either skipping single-spa-angular@3, or creating a minor version and then documenting the breaking changes.

internettrans avatar Dec 07 '20 19:12 internettrans

I wouldn't open a new major just for this. Handling many majors is confusing for everyone. Maybe leave it as an option for the future.

daniloesk avatar Dec 08 '20 13:12 daniloesk

It’s been mostly 3 years since this issue was opened. I do consider this makes sense since Angular deprecated UMD format long time ago. I don’t think there’s any reason to keep maintaining UMD bundles. Sharing dependencies is only possible through the SystemJS for now (at least this is the only less problematic way). We also have system bundles published for angular in esm-bundle repo.

arturovt avatar Dec 29 '22 19:12 arturovt