Skip to content
This repository was archived by the owner on Jan 6, 2024. It is now read-only.
This repository was archived by the owner on Jan 6, 2024. It is now read-only.

Since 1.1.3 'Cannot use import statement outside a module' #9

@yaakovfeldman

Description

@yaakovfeldman

Thank you very much for this library. It worked perfectly on version 1.1.2. However, on version 1.1.3 I get the error SyntaxError: Cannot use import statement outside a module when using the firebase package.

My node app uses require but this is somehow getting changed to import.

I made a minimal example at https://github.com/yaakovfeldman/jest-issue

Running npm run test with version 1.1.2 should produce no issues (except for jest complaining that the test suite contains no tests).

Updating to version 1.1.3 produces:

Details:

    C:\Users\yfeld\Code\school databases\jest-issue\node_modules\firebase\app\dist\index.esm.js:1
    ({"Object.<anonymous>":function(module,exports,require,__dirname,__filename,jest){import { registerVersion } from '@firebase/app';
                                                                                      ^^^^^^

    SyntaxError: Cannot use import statement outside a module

      1 | const express = require('express')
    > 2 | const { initializeApp } = require('firebase/app');
        |                           ^
      3 | //const admin = require('firebase-admin');
      4 |
      5 | const app = express()

      at Runtime.createScriptFromCode (node_modules/jest-runtime/build/index.js:1728:14)
      at Object.<anonymous> (app.js:2:27)

Test Suites: 1 failed, 1 total

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions