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

ES6 Suport Broken #2543

Open
bassrock opened this issue May 3, 2024 · 3 comments
Open

ES6 Suport Broken #2543

bassrock opened this issue May 3, 2024 · 3 comments

Comments

@bassrock
Copy link

bassrock commented May 3, 2024

Describe your environment

  • Operating System version: mac osx
  • Firebase SDK version: 12.1.0
  • Firebase Product: gcm/push
  • Node.js version: 20.11
  • PNPM version: 8

Steps to reproduce:

When using firebase sdk in an ES6 environment where the tsconfig looks like:

{
  "$schema": "https://json.schemastore.org/tsconfig",
  "compilerOptions": {
    "experimentalDecorators": true,
    "emitDecoratorMetadata": true,
    "target": "ESNext",
    "module": "NodeNext",
    "moduleResolution": "NodeNext",
    "removeComments": true,
    "esModuleInterop": true,
    "noEmitOnError": false,
    "sourceMap": true,
    "inlineSources": true,
    "sourceRoot": "/",
    "declaration": true,
    "noEmitHelpers": true,
    "importHelpers": true
  }
}

and the package.json is set to type: "module" you get the following error with the long module:

../../node_modules/.pnpm/long@5.2.3/node_modules/long/umd/index.d.ts:1:18 - error TS1479: The current file is a CommonJS module whose imports will produce 'require' calls; however, the referenced file is an ECMAScript module and cannot be imported with 'require'. Consider writing a dynamic 'import("../index.js")' call instead.

Relevant Code:

I believe the issue may be this line

but I am not totally sure.

@google-oss-bot
Copy link

I found a few problems with this issue:

  • I couldn't figure out how to label this issue, so I've labeled it for a human to triage. Hang tight.
  • This issue does not seem to follow the issue template. Make sure you provide all the required information.

@elliottAtTreatment
Copy link

elliottAtTreatment commented May 9, 2024

My entire team and i also ran into this issue. Been present for at least several weeks if not much longer. It occurs in all our applications using typescript, node.js, and a firebase-admin import.

We now have been resorting to adding:
"skipLibCheck": true

tsconfig:
{
"compilerOptions": {
"rootDir": "src",
"outDir": "dist",
"target": "es2022",
"module": "NodeNext",
"sourceMap": true,
"allowJs": false,
"alwaysStrict": true,
"resolveJsonModule": true,
"noImplicitAny": true,
"strictNullChecks": true,
"esModuleInterop": true,
"skipLibCheck": true
}
}

@lahirumaramba
Copy link
Member

Hey folks, thanks for reporting this issue! I am having trouble reproducing this... my code seem to build on NodeJS 20.11 with ES6. Are you able to provide us a minimal repro? Thanks!

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

4 participants