Sitecore / jss

Software development kit for JavaScript developers building web applications with Sitecore Experience Platform
https://jss.sitecore.com
Apache License 2.0
262 stars 272 forks source link

@sitecore-jss/sitecore-jss optimization bailout #519

Closed evtk closed 3 years ago

evtk commented 3 years ago

Description

Apparently, the Sitecore-JSS-Angular module, cannot resolve the Sitecore-Jss module as an esm module:

Warning: /angular/node_modules/@sitecore-jss/sitecore-jss-angular/__ivy_ngcc__/dist/esm2015/public_api.js depends on '@sitecore-jss/sitecore-jss'. CommonJS or AMD dependencies can cause optimization bailouts. For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Expected behavior

Angular should not throw warnings on this (of course they can be suppressed), but instead should be able to load the sitecore-jss module as esm.

Steps To Reproduce

This can be easily reproduced when loading the sample app.

ambrauer commented 3 years ago

@EvtK I've added a backlog item to address this. As you mention, you can suppress (and in fact is in the latest version), but we should ideally compile and publish both CommonJS and ESM versions of the sitecore-jss package to allow optimization.

evtk commented 3 years ago

Hi @ambrauer thanks for the quick response and putting it on the backlog. Yes I can see it is fixed in the sample app, but of course for our corporate angular projects we have to manually suppress these (running NX with 40+ apps :) ).

Looking forward to the fix!

evtk commented 3 years ago

Hi @ambrauer is there any progress on this issue? Hope to hear, thanks.

ambrauer commented 3 years ago

Hi @EvtK we're aiming to fit this in for JSS v19, which is slated for release later this year.