After upgrading to Angular 10, my download file-saver saveAs
triggers the following compilation warning:
CommonJS or AMD dependencies can cause optimization bailouts.
The compiler also provides a link to an explanation and how to disable the warning. Instead of disabling the warning, is there a ES bundle implementation for the saveAs
functionality?
Use file-saver-es instead.
npm install -S file-saver-es
Then in your code import saveAs and other codes keep as before.
import { saveAs } from 'file-saver-es';
and if you're using typescript add following to your tsconfig
:
"paths": {
"file-saver-es": [
"@types/file-saver"
]
}