在create-react-app上运行构建后的空白页 [英] Blank page after running build on create-react-app

查看:279
本文介绍了在create-react-app上运行构建后的空白页的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尝试在netlify上部署create-react-app,但是我的构建是空白页。我正在使用.env文件加载firebase api密钥是生成问题吗?

Trying to deploy create-react-app on netlify, however my build is blank page. I'm using .env file for loading firebase api key is that a problem for build?

即使我尝试在计算机上本地打开空白页,在控制台中输出错误:使用源 file:///event-app/static/js/main.108757a0.js的加载失败

Even when I tried to open it locally on my computer its blank page and it outputs an error in console: "Loading failed for the with source "file:///event-app/static/js/main.108757a0.js""

package .json:
https://gist.github.com/Verthon/f82371ad2bb636b2e95c5b7697aa0bb5

package.json: https://gist.github.com/Verthon/f82371ad2bb636b2e95c5b7697aa0bb5

➜  event-app git:(master) ✗ npm run build

> event-app@0.1.0 build /home/jurr/Projects/event-app
> node scripts/build.js

Creating an optimized production build...
Compiled with warnings.

./src/components/Router.js
  Line 12:  'withFirebase' is defined but never used  no-unused-vars

./src/components/Firebase.js
  Line 21:  'Firebase' is defined but never used  no-unused-vars

Search for the keywords to learn more about each warning.
To ignore, add // eslint-disable-next-line to the line before.

File sizes after gzip:

  282.86 KB  build/static/js/main.108757a0.js
  3.1 KB     build/static/css/main.8e671453.css


推荐答案

我通过以下方法解决了问题根据此文档主页:。 noreferrer> https://facebook.github.io/create-react-app/docs/deployment

I have solved the problem by setting homepage: "." according to this doc https://facebook.github.io/create-react-app/docs/deployment

这篇关于在create-react-app上运行构建后的空白页的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆