简体   繁体   English

MIT react-starter-kit的main.js 404错误

[英]main.js 404 error for MIT react-starter-kit

I'm using Kriasoft's react starter kit , and I built a small app. 我正在使用Kriasoft的react入门套件 ,并且构建了一个小应用程序。 Everything runs perfectly locally w/ Browserify, however when I try running the production server at /build/server.js, the main.js file gives a 404 error in the Chrome console and some of my code breaks. 一切都可以在本地通过浏览器完美运行,但是当我尝试在/build/server.js上运行生产服务器时,main.js文件在Chrome控制台中出现404错误,并且我的代码有些中断。

I've done some research and looked around -- I think it has something to do with Browserify, but I haven't been able to figure it out. 我已经做了一些研究,环顾四周-我认为它与Browserify有关,但我一直无法弄清楚。

Can someone explain me what I'm doing wrong and what the root of the issue is? 有人可以向我解释我做错了什么,问题的根源是什么? :) :)

通过浏览器 通过运行节点build / server.js

This issue is addressed here . 此问题已在此处解决。 The build needs to be run with the "release" option when testing without Browsersync/HMR/React Transform. 在不使用Browsersync / HMR / React Transform进行测试时,需要使用“发布”选项来运行构建。

npm run build -- --release && node build/server.js

Otherwise, the bundle will not build properly. 否则,捆绑包将无法正确构建。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM