Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FR: Support module import in the "firebase" package for Nodejs 13/14 #3069

Open
Feiyang1 opened this issue May 15, 2020 · 3 comments
Open

FR: Support module import in the "firebase" package for Nodejs 13/14 #3069

Feiyang1 opened this issue May 15, 2020 · 3 comments

Comments

@Feiyang1
Copy link
Member

Submodule resolution algorithm for module import has changed since Nodejs 13 and our current way of defining submodules using nested package.jsons doesn't work anymore, see nodejs/node#33410

We should use the "exports" field in the root package.json instead:

{
  "exports": {
    "./app": "./app/dist/index.cjs.js"
  }
}

Note that this only affects importing firebase in Nodejs.

@Feiyang1 Feiyang1 changed the title FR: Support module import in "firebase" package for Nodejs 13/14 FR: Support module import in the "firebase" package for Nodejs 13/14 May 15, 2020
@akauppi
Copy link

akauppi commented Sep 14, 2020

Is something proceeding with this?

Note that this only affects importing firebase in Nodejs.

I think it also matters to web apps using browser native ES modules. I am working on one and am happy to help testing.

@logemann
Copy link

ran into the same issue while coding a little node command line program.
Switched back to require firebase modules.

Didnt even get why a package will try to load a complete different module (firestore-auto-import) which is not even installed:

Error [ERR_UNSUPPORTED_DIR_IMPORT]: 
Directory import '/Users/ml/dev/projects/nodejs/firestore-auto-import/node_modules/firebase/auth' 
is not supported resolving ES modules imported from 
/Users/ml/dev/projects/nodejs/firestore-auto-import/index.js
Did you mean to import firebase/auth/dist/index.cjs.js?

thats what i had before:

import firebase from 'firebase/app';
import 'firebase/auth';
import 'firebase/database';

@dobromyslov
Copy link

Update to Node 16 solved issues with ERR_UNSUPPORTED_DIR_IMPORT for me.
Also you may try to add node parameter --experimental-specifier-resolution=node

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

No branches or pull requests

5 participants