Skip to content

ES6 Suport Broken #2543

Closed
Closed
@bassrock

Description

@bassrock

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/[email protected]/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.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions