Using the firebase/analytics framework causes the entire application to stop working
See original GitHub issueDescribe the bug
When importing the firebase/analytics
sub-package from the firebase
framework, everything stops working. Using the rest of the framework seems to be fine. It’s unclear if this is a problem with firebase (likely) or vite, but figured I’d ask here first.
The following works:
import firebase from "firebase/app";
import "firebase/auth";
The following does not:
import firebase from "firebase/app";
import "firebase/auth";
import "firebase/analytics";
Just including the main import with analytics will also fail:
import firebase from "firebase/app";
import "firebase/analytics";
Reproduction
I’ve tried this both the firebase version 8 and version 9 libraries.
yarn create @vitejs/app
: options vue
then vue-ts
Edit src/main.ts
to add:
import firebase from "firebase/app";
import "firebase/analytics"
and:
const firebaseConfig = {
// put your firebase config here
};
firebase.initializeApp(firebaseConfig);
System Info
Output of npx envinfo --system --npmPackages vite,@vitejs/plugin-vue --binaries --browsers
:
System:
OS: Linux 5.8 Ubuntu 20.04.2 LTS (Focal Fossa)
CPU: (8) x64 Intel(R) Core(TM) i7-10510U CPU @ 1.80GHz
Memory: 4.91 GB / 15.34 GB
Container: Yes
Shell: 5.8 - /usr/bin/zsh
Binaries:
Node: 14.5.0 - ~/Development/.sdks/node/current/bin/node
Yarn: 1.22.4 - ~/.applications/yarn/bin/yarn
npm: 7.14.0 - ~/Development/.sdks/node/current/bin/npm
Browsers:
Chrome: 91.0.4472.77
Chromium: 91.0.4472.77
npmPackages:
@vitejs/plugin-vue: ^1.2.3 => 1.2.3
vite: ^2.3.5 => 2.3.5
Used package manager: yarn
Logs
The in-browser error console then contains:
Loading failed for the module with source “http://localhost:3001/node_modules/.vite/firebase_analytics.js?v=ad93ae6b”. localhost:3001:12:1
[vite] connecting... client.ts:13:8
Loading failed for the module with source “http://localhost:3001/node_modules/.vite/firebase_app.js?v=ad93ae6b”. localhost:3001:12:1
[vite] connected. client.ts:43:14
Loading failed for the module with source “http://localhost:3001/node_modules/.vite/vue.js?v=ad93ae6b”. localhost:3001:12:1
Loading failed for the module with source “http://localhost:3001/src/App.vue”. localhost:3001:12:1
Before submitting the issue, please make sure you do the following
- Read the Contributing Guidelines.
- Read the docs.
- Check that there isn’t already an issue that reports the same bug to avoid creating a duplicate.
- Provide a description in this issue that describes the bug.
- Make sure this is a Vite issue and not a framework-specific issue. For example, if it’s a Vue SFC related bug, it should likely be reported to https://github.com/vuejs/vue-next instead.
- Check that this is a concrete bug. For Q&A open a GitHub Discussion or join our Discord Chat Server.
Issue Analytics
- State:
- Created 2 years ago
- Reactions:1
- Comments:7 (2 by maintainers)
Top Results From Across the Web
Completely disable Firebase/Analytics to stop console spam ...
I don't want or need FirebaseAnalytics. FirebaseAnalytics spams the developer console with 8 lines of output when our app starts: 2017-06-07 ...
Read more >Xcode 13 "Missing package product"… - Apple Developer
In my workspace, I have a "Kit" project that generates a framework using several ... derived data, or restarting the application does not...
Read more >Get started with Firebase Crashlytics - Google
If you've refreshed the console and you're still not seeing the test crash after five minutes, enable debug logging to see if your...
Read more >Firebase analytics in React native app - Enappd
React Native applications render using real mobile UI components, not webviews, and will look and feel like any other native mobile application.
Read more >What is Firebase? All secrets unlocked - Back4App Blog
Firebase makes application development convenient and helps to keep costs low. Using Firebase also allows developers and companies to standardize the backend ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
@lukef I just ran into exactly the same problem, and figured out that the culprit was uBlock origin extension.
On chrome, the status in the network tab was (blocked: other), and error printed to console was
But on firefox, it more conveniently told me via the network tab in the Transferred column: “Blocked by uBlock Origin” And the error in console was:
Disabling the extension made my app load in both chrome and firefox.
I’ll go ahead and assume this is an issue with the ad blocker as OP hasn’t responded since https://github.com/vitejs/vite/issues/3612#issuecomment-892534394. I’ve seen similar issues in the pass too where the dev server crashes because of the word “analytics”.
It should be dev only as Vite loads the path raw, like
http://localhost:3000/bla/node_modules/@firebase/analytics/index.js
. In build, it is bundled into hashed chunks without the word “analytics”.