Closed roti closed 4 years ago
just add window.fileDownload = require('js-file-download') in app.js file and use it like fileDownload(fileLocation, filename);
@roti I'm not able to reproduce this in my projects. I use
import fileDownload from 'js-file-download'
without any errors. Are you using Babel or Typescript? Could you please put together a codepen or small repo that reproduces the problem?
Closing due to inactivity. Please feel free to open a new issue if this persists.
When using
js-file-download
with an ES6 import it expects the default export to be in.default
. When importing like this:I get following error:
This is probably some incompatibility between CommonJS and ES6 modules. There is a workaround, using the entire module as the function: