Filesaver.js: Version 2.0.0 cannot be used with rollup

Created on 16 Jan 2019  路  2Comments  路  Source: eligrey/FileSaver.js

I'm trying to use file-saver version 2.0.0 with rollup, but I get the following error:

(!) Missing exports
https://rollupjs.org/guide/en#error-name-is-not-exported-by-module-
src/ExportCsv.js
saveAs is not exported by node_modules/file-saver/dist/FileSaver.min.js

I'm importing it using:

import * as FileSaver from 'file-saver';

tried also:

import { saveAs } from 'file-saver';

Version 1.3.8 works correctly. I don't understand exactly why.

Any idea?

Most helpful comment

I don't know the cause, but now rollup.js will give you a hint.
A solution that worked for me was:
commonjs({ namedExports: { 'file-saver': [ 'saveAs' ] } })

All 2 comments

I don't know the cause, but now rollup.js will give you a hint.
A solution that worked for me was:
commonjs({ namedExports: { 'file-saver': [ 'saveAs' ] } })

I have the same issue in a StencilJS/ Rollup project.

@davideicardi thanks for the 1.3.8 hint!

Was this page helpful?
0 / 5 - 0 ratings

Related issues

MFEKN picture MFEKN  路  5Comments

sangyeol-kim picture sangyeol-kim  路  5Comments

danielbronder picture danielbronder  路  6Comments

nomego picture nomego  路  6Comments

bholyfield picture bholyfield  路  6Comments