Open gillesfabre34 opened 6 years ago
Not sure what changed or why this is now necessary, but I resolved this my changing my import to import fileSaver from 'file-saver';
and using fileSaver.saveAs
.
import export module.exports is hard to get right. how can it be so difficult?
damm it i'm switching back to moduie.export = saveAs
screw export syntax
module.exports
seems to solve most stuff
@jimmywarting i now cannot import this with normal ES6 module imports, i do only use this in dev but it's quite frustrating for now - would you be able to look into making this work with everything?
I don't know how to make it work for everything
it's ok, i understand and it's not really your fault, it's more just a problem with how much the JS ecosystem sucks in general. Thanks for trying anyway.
For the libraries i use commonly, moment seems to have it working for everything so maybe it's worth looking into see what they do?
Hi,
and thanks all for your help. I fixed this bug with this import, without any { } :
import saveAs from 'file-saver';
I guess this issue can be closed now.
I'd probably keep it open until it works on everything, or remade with a better header.
Maybe src
would have simple ES6 module which browser can import directly. Also most if not all modern bundles can handle ES6 imports. dist
could just have a build which attaches saveAs
to window
You have to include types. npm install @types/file-saver --save
How can i do download with specific path? Like "C:\example.zip"
How can i do download with specific path?
@viss3595 you can't. you need to change your browser settings for that
You have to include types.
npm install @types/file-saver --save
and from there ? how to import and use as ES6 module ?
import saveAs from 'file-saver' is not work. import {saveAs} from 'file-saver'; not work too( I get "Uncaught SyntaxError: Unexpected identifier "
Using 'npm install file-saver --save' instead of 'npm install @types/file-saver --save' solved my problem,you can try it
I used "const { saveAs } = require('file-saver');" instead of "import" and it worked (reactjs+nextjs)
Hello,
I have the message error "export 'saveAs' was not found in 'file-saver'" That's strange, beacause I have "file-saver": "^2.0.0-rc.2", in my package.json, and I have too the directory "file-saver" in my node_modules folder. So I don't understand why I have this error message.
Thanks for your help