Skip to content

ESM modules are not supported using Javascript even though Google Cloud function support them #1349

@arisAlexis

Description

@arisAlexis

Related issues

[REQUIRED]

node:
18.13.0

firebase-functions: 4.2.0

firebase-tools: 11.22.0

firebase-admin: 10.3.0

[REQUIRED] Test case

[REQUIRED] Steps to reproduce

index.js file includes:

async function f() {
    const a = await import("b");
}

or a plain import on top.

[REQUIRED] Expected behavior

Should run since Google Cloud Functions support ESM modules for 2 years now.

[REQUIRED] Actual behavior

Linter error "unexpected token import". Note that adding "type":"module" to package.json doesn't solve the problem since the linter file is recognised as a module etc.

Were you able to successfully deploy your functions?

no

29:32 error Parsing error: Unexpected token import

✖ 1 problem (1 error, 0 warnings)

node:events:491
throw er; // Unhandled 'error' event
^

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions