Can't import moltin using es6
See original GitHub issueHi,
I can’t be able to import moltin in react using es6. I got the following error:
Uncaught TypeError: (0 , _moltin.gateway) is not a function
// this doesn't work
import {gateway as MoltinGateway} from 'moltin';
It because I think you’ve not provided any index.js
file in src
folder.
The only way to make it work using dist folder:
// It worked
import {gateway as MoltinGateway} from 'moltin/dist/moltin.cjs.js';
Please add the index.js
file in src folder.
Issue Analytics
- State:
- Created 6 years ago
- Comments:12 (6 by maintainers)
Top Results From Across the Web
Cannot import router from file with ES6 import/export?
I am converting my whole node app to use the ES6 syntax import NME from "./file". In my app.js file I am trying...
Read more >Can't import npm package using es6 module #233 - GitHub
Hi, sorry for a stupid question, but I just can't seem to import the Cookies object in my project no matter what I...
Read more >How to use an ES6 import in Node.js? - GeeksforGeeks
Introduction to ES6 import: The import statement is used to import modules that are exported by some other module. A module is a...
Read more >export - JavaScript - MDN Web Docs
The export declaration is used to export values from a JavaScript module. Exported values can then be imported into other programs with the ......
Read more >How to use ES6 import syntax in Node.js - DEV Community
The solution to this error is in the first line of the above error snippet and is now a recommend way by Node.js....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Currently I’m also using master branch with slight modifications to support querying like this:
Hi @eashish93 ,
I encountered the same problem as you, I fixed it by using the following:
import {gateway as MoltinGateway} from 'moltin'
and then:
The syntax
client_id
is the key 😉