Replies: 2 comments 11 replies
-
It's already been implemented at #1249 |
Beta Was this translation helpful? Give feedback.
4 replies
-
I've published an alpha.1 release to the exp tag. Haven't updated the modular-admin site yet about ESM support (will work on it later), but you should be able to try out ESM with Node.js 12+ using this latest alpha build. Please let us know how it goes. To install:
Sample code: import { initializeApp } from 'firebase-admin/app';
import { getAuth } from 'firebase-admin/auth';
initializeApp();
(async () => {
const token = await getAuth().createCustomToken('alice');
console.log(token);
})(); Also note that the Firebase Functions environment does not support ESM. So you cannot use ESM entry points in your cloud functions. |
Beta Was this translation helpful? Give feedback.
7 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Examples in the documentation (https://modular-admin.web.app/) instruct use of the new modular imports. This causes confusion to users when using an ESM bundled tool, such as https://kit.svelte.dev/ (which is powered by https://vitejs.dev/ for both Web client-side bundling and SSR server-side bundling), which uses named ESM imports, because of the lack of note about ESM-CJS interop in that documentation site. The GitHub issues #1230 explains the situation
This confusion is compounded people because the Client SDK is moving to be modular and ESM friendly, so when looking strictly at the https://modular-admin.web.app/ docs page we get no indication that ESM-CJS interop mode is required for usage in ESM server environments.
Futher, the docs https://modular-admin.web.app/ state:
Does this then suggest that the ESM-CJS interop will no longer be needed at some point?
ESM entry points are extremely important for the:
In the meantime, including the ESM-CJS interop in the docs site would reduce confusion.
If anything was unclear, or I misunderstood, please let me know 😃
Beta Was this translation helpful? Give feedback.
All reactions