-
Notifications
You must be signed in to change notification settings - Fork 892
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
Vitest having problems with the types of firebase/auth/web-extension #8115
Comments
We need to add this plugin https://github.com/firebase/firebase-js-sdk/blob/master/packages/auth/rollup.config.js#L170 to the web-extension build, which injects a package.json sibling file next to the bundle that just says "{type: module}". I think we actually need to have it on the main auth build too, I'm surprised it hasn't been a problem there. |
The Firebase Auth webextension bundle was previously being shipped as a CommonJS package rather than a ES module, because it did not have a module package file indicating that it was an ES module. Fixes #8115
The Firebase Auth webextension bundle was previously being shipped as a CommonJS package rather than a ES module, because it did not have a module package file indicating that it was an ES module. Fixes #8115
The Firebase Auth webextension bundle was previously being shipped as a CommonJS package rather than a ES module, because it did not have a module package file indicating that it was an ES module. Fixes #8115
I believe we're using this update. Still seeing some issues with typings not quite lining up in Typescript 5.4.2:
|
Hi @wegry, sorry for missing your comment. |
The Firebase Auth webextension bundle was previously being shipped as a CommonJS package rather than a ES module, because it did not have a module package file indicating that it was an ES module. Fixes #8115
Operating System
Windows 11
Browser Version
No browser was used for the test
Firebase SDK Version
10.10.0
Firebase SDK Product:
Auth
Describe your project's tooling
Vue 3 app with Vite and Vitest all with typescript.
Describe the problem
After updating Firebase and changing my imports from
"firebase/auth"
to"firebase/auth/web-extension"
, one of my Vitests fails.The test is very simple and it just checks if a function returns the right strings. But the function that is being tested is in a .ts file that also imports
onAuthStateChanged
from"firebase/auth/web-extension"
. This is what gives me the error; if I remove it, I don't get the error.This is the error:
Vitest caught 1 unhandled error during the test run.
This error originated in "mytest.test.ts" test file. It doesn't mean the error was thrown inside the file itself, but while it was running.
Module ...node_modules/@firebase/auth/dist/web-extension-esm2017/index.js:1 seems to be an ES Module but shipped in a CommonJS package. You might want to create an issue to the package "@firebase/auth" asking them to ship the file in .mjs extension or add "type": "module" in their package.json.
Steps and code to reproduce issue
Create a vite test in vitest called for example
mytest.test.ts
with this code:The text was updated successfully, but these errors were encountered: