Skip to content

Deduping ESM and CJS versions of the same package #18082

Discussion options

You must be logged in to vote

Everywhere I use import ... from '@firebase/...' it does use the esm2017 build, but I do use other dependencies (in particular next-firebase-auth) that itself uses require('@firebase/...') and that results in the browser-cjs build to be included as well

FWIW next-firebase-auth's source code uses TypeScript with import, but then they also use Webpack on their side to produce the dist file which is CJS only. I tried forking it to make Webpack output import statements but it seems quite involved as it implies turning the whole package into a ESM module

So far I've come up with a solution using config.reslove.alias

config.resolve.alias = {
  '@firebase/auth': 'path/to/node_modules/@firebase/a…

Replies: 4 comments 2 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
2 replies
@valeriangalliat
Comment options

Answer selected by valeriangalliat
@alexander-akait
Comment options

Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants
Converted from issue

This discussion was converted from issue #18080 on February 15, 2024 10:28.