本地运行Firebase项目加载缓慢,显示“Waiting for wzrd.in...”求助
Hey Leo, let's tackle this frustrating slow load issue you're seeing locally—here's what's going on and how to fix it:
First: The Node Version Warning Isn't the Culprit
That warning about Node.js v10.15.1 vs Google Cloud Functions' v6.11.5 is just a heads-up for your backend functions, not related to your frontend page loading slowly. Since your deployed project loads fast, your functions are working fine in production—this warning is just telling you your local Node version doesn't match what Cloud Functions uses, but it won't cause frontend delays.
The Real Issue: wzrd.in Dependency
wzrd.in is a browserify CDN that serves bundled JavaScript on-demand. The "Waiting for wzrd.in..." message means your local project is trying to pull a script from this CDN, and the request is getting stuck (maybe due to network restrictions, CDN downtime, or slow local network).
Since your deployed site loads quickly, it's likely your production build has already bundled all dependencies locally, so it doesn't rely on wzrd.in anymore. Your local dev setup is still using the dynamic CDN reference, which is causing the delay.
Step-by-Step Fixes
- Check for wzrd.in references: Go through your HTML files and client-side JS code to find any lines like
<script src="https://wzrd.in/...">or dynamic imports pointing to wzrd.in. Replace these with:- A locally bundled version of the script (run your bundler like browserify to package dependencies into a local file)
- A more reliable CDN if you need a remote source
- Pre-bundle dependencies locally: If you're using browserify or a similar tool, run the bundling command manually before starting
firebase serve(e.g.,browserify src/index.js -o dist/bundle.js) so your local setup uses the pre-built file instead of fetching from wzrd.in. - Clear local caches: Sometimes Firebase's local simulator or browser cache can cause stuck requests. Try:
- Restarting
firebase servewith the cache-clearing flag:firebase serve --clear-cache - Clearing your browser's cache and reloading the page
- Restarting
- (Optional) Fix the Node version warning: If you want to get rid of that warning entirely, use a version manager like nvm to install Node v6.11.5:
Note that Node v6 is end-of-life, but it's safe for local development to match Cloud Functions' old requirements. If you plan to update your Cloud Functions later, you'll need to upgrade to a supported Node version.nvm install 6.11.5 nvm use 6.11.5
Quick Recap
Your local load delay is caused by a stuck request to wzrd.in, not the Node version warning. Focus on replacing or bundling that dependency locally, and clear caches if needed—your deployed site is fast because it doesn't rely on that CDN anymore.
内容的提问来源于stack exchange,提问作者Leo

