Skip to content
This repository has been archived by the owner on Mar 13, 2020. It is now read-only.

es6 imports are not working properly. #122

Closed
bhargavkonkathi opened this issue May 23, 2018 · 5 comments
Closed

es6 imports are not working properly. #122

bhargavkonkathi opened this issue May 23, 2018 · 5 comments

Comments

@bhargavkonkathi
Copy link

bhargavkonkathi commented May 23, 2018

Trying to use redux-firestore but got errors like these.
The requested module '../node_modules/redux-firestore/es/index.js' does not provide an export named 'reduxFirestore'

@keanulee
Copy link
Contributor

Despite the misleading directory, looks like es/index.js isn't actually an ES module (doesn't use export { reduxFirestore } syntax). For reference, it should look like Redux. Consider making an issue with redux-firestore.

@goatandsheep
Copy link

@keanulee is there a way to compile it anyway using a gulp plugin?

@keanulee
Copy link
Contributor

I'm unaware of any ways to convert module.exports code to ES modules (so that it can be safely consumed by our tools).

@goatandsheep
Copy link

goatandsheep commented Nov 27, 2018

Ok. I'll wait for a webpack template then before I experiment. Cheers!

@frankiefu
Copy link
Member

One workaround which you can give it a try... if the library provides an UMD build (which I believe redux-firestore does) you could try to import the UMD module from a JavaScript module and have it export to the global object.
e.g.

import 'redux-firestore/dist/redux-firestore.js';

const { reduxFirestore } = self.ReduxFirestore;

This might not work if the library is not doing the right thing... see this issue for more info.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants