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

AnalogJS + Firebase issues #1296

Closed
2 tasks
alexcibotari opened this issue Aug 26, 2024 · 4 comments · Fixed by #1298
Closed
2 tasks

AnalogJS + Firebase issues #1296

alexcibotari opened this issue Aug 26, 2024 · 4 comments · Fixed by #1298
Labels
bug Something isn't working

Comments

@alexcibotari
Copy link

alexcibotari commented Aug 26, 2024

Please provide the environment you discovered this bug in.

https://github.com/Lessify/localess-web

Which area/package is the issue in?

platform

Description

After Upgrade from AnalogJS v1.6.2-beta2 to v1.7.2 I receive next error :

Please provide the exception or error you saw

**\node_modules\rxfire\auth\index.esm.js:1
import { onAuthStateChanged, onIdTokenChanged, getIdToken } from 'firebase/auth';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (node:internal/modules/cjs/loader:1281:20)
    at Module._compile (node:internal/modules/cjs/loader:1321:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at cjsLoader (node:internal/modules/esm/translators:348:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24

Other information

No response

I would be willing to submit a PR to fix this issue

  • Yes
  • No
@alexcibotari alexcibotari added the bug Something isn't working label Aug 26, 2024
@analogjs analogjs deleted a comment Aug 26, 2024
@brandonroberts
Copy link
Member

Try adding rxfire/** to the ssr.noExternal array in the vite.config.ts. We're autodetecting SSR dependencies that need transforming, but this one may have not been picked up.

@alexcibotari
Copy link
Author

alexcibotari commented Aug 26, 2024

Hello @brandonroberts , Error remains the same, with more details :

config

ssr: {
      noExternal: [
        '@angular/fire',
        'rxfire/**',
        'firebase/**',
        'firebase',
        'firebase-functions',
      ],
    },

error


(node:13904) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
16:47:50 [vite] Error when evaluating SSR module /node_modules/@angular/fire/fesm2022/angular-fire-auth.mjs: failed to import "rxfire/auth"
|- **\localess-web\node_modules\rxfire\auth\index.esm.js:1
import { onAuthStateChanged, onIdTokenChanged, getIdToken } from 'firebase/auth';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (node:internal/modules/cjs/loader:1281:20)
    at Module._compile (node:internal/modules/cjs/loader:1321:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at cjsLoader (node:internal/modules/esm/translators:348:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)

16:47:50 [vite] Error when evaluating SSR module /node_modules/@angular/fire/fesm2022/angular-fire-analytics.mjs: failed to import "rxfire/auth"
|- **\localess-web\node_modules\rxfire\auth\index.esm.js:1
import { onAuthStateChanged, onIdTokenChanged, getIdToken } from 'firebase/auth';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at wrapSafe (node:internal/modules/cjs/loader:1281:20)
    at Module._compile (node:internal/modules/cjs/loader:1321:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1416:10)
    at Module.load (node:internal/modules/cjs/loader:1208:32)
    at Module._load (node:internal/modules/cjs/loader:1024:12)
    at cjsLoader (node:internal/modules/esm/translators:348:17)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:297:7)
    at ModuleJob.run (node:internal/modules/esm/module_job:222:25)
    at async ModuleLoader.import (node:internal/modules/esm/loader:316:24)

16:47:50 [vite] Error when evaluating SSR module /src/app/app.config.ts: failed to import "rxfire/auth"
|- **\localess-web\node_modules\rxfire\auth\index.esm.js:1
import { onAuthStateChanged, onIdTokenChanged, getIdToken } from 'firebase/auth';
^^^^^^


@brandonroberts
Copy link
Member

Fix is released in 1.7.3-beta.4

@alexcibotari
Copy link
Author

Works

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants
@brandonroberts @alexcibotari and others