Any plan to support ES modules?
Basically all that is required is
export { saveAs };
at the end, similarly to the module.exports today.
This could also be stripped (if deemed necessary) when compiling the dist output.
Any plan to support ES modules?
Basically all that is required is
export { saveAs };at the end, similarly to the module.exports today.
This could also be stripped (if deemed necessary) when compiling the dist output.
Good idea.
When I add at the final:
export { saveAs };
It not work.
Currently using file-saver in an Angular version 10+ application gives the following build warning:
WARNING in [filename] depends on 'file-saver'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies
Starting with Angular 10 the Angular CLI now provide warnings for CommonJS modules. Read more about it here:
https://blog.angular.io/version-10-of-angular-now-available-78960babd41
When you use a dependency that is packaged with CommonJS, it can result in larger slower applications.
Starting with version 10, we now warn you when your build pulls in one of these bundles. If you鈥檝e started seeing these warnings for your dependencies, let your dependency know that you鈥檇 prefer an ECMAScript module (ESM) bundle.
And here:
https://angular.io/guide/build#configuring-commonjs-dependencies
It is recommended that you avoid depending on CommonJS modules in your Angular applications. Depending on CommonJS modules can prevent bundlers and minifiers from optimizing your application, which results in larger bundle sizes. Instead, it is recommended that you use ECMAScript modules in your entire application. For more information, see How CommonJS is making your bundles larger
Hello, I reached this issue by looking for any solution for the Angular 10 warnings (_CommonJS or AMD dependencies can cause optimization bailouts._), rather that simply ignore them by configuring allowedCommonJsDependencies in angular.json.
Is there any plan to build file-saver as ECMAScript module and make Angular happy?
Any news about this?
Any ETA ?
I am getting warning in VS code using Angular 11.0.5
Warning: app.component.ts depends on 'file-saver'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see: https://angular.io/guide/build#configuring-commonjs-dependencies

Same here, would love to see this resolved...
Most helpful comment
Currently using file-saver in an Angular version 10+ application gives the following build warning:
Starting with Angular 10 the Angular CLI now provide warnings for CommonJS modules. Read more about it here:
https://blog.angular.io/version-10-of-angular-now-available-78960babd41
And here:
https://angular.io/guide/build#configuring-commonjs-dependencies