single-spa / single-spa-angular

Helpers for building single-spa applications which use Angular
Apache License 2.0
201 stars 78 forks source link

system as default libraryTarget #315

Open daniloesk opened 3 years ago

daniloesk commented 3 years ago

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

joeldenning commented 3 years ago

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.

daniloesk commented 3 years ago

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

joeldenning commented 3 years ago

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.

daniloesk commented 3 years ago

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.

arturovt commented 1 year ago

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.