[英]react-boilerplate yarn start:prod This site can’t be reached localhost refused to connect. http://localhost:3000 => https://localhost/
https://github.com/react-boilerplate/react-boilerplate https://github.com/react-boilerplate/react-boilerplate
After running yarn run build, yarn start:prod It says it is running on the terminal window, however, when i go to http://localhost:3000 the url suddenly changes to => https://localhost/ and says this site can't be reached localhost refused to connect. 运行yarn run build之后,yarn start:prod它说它正在终端窗口上运行,但是,当我转到http:// localhost:3000时 ,URL突然变为=> https:// localhost /并说此站点无法访问localhost拒绝连接。
development mode yarn start works fine 开发模式纱线启动正常
I removed ImmutableJS following the guide from one of the issues in react-boilerplate. 我按照指南从React-Boilerplate中的问题之一删除了ImmutableJS。
I added feathersJS backend, frontend. 我添加了feathersJS后端,前端。
I changed babel-loader in webpack.base.babel.js to 我将webpack.base.babel.js中的babel-loader更改为
rules: [
{
test: /\.js$/, // Transform all .js files required somewhere with Babel
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: options.babelQuery,
query: {
plugins: [
["import", { "libraryName": "antd", "libraryDirectory": "es", "style": "css" }]
],
},
},
},
I changed the app.js file 我更改了app.js文件
// Install ServiceWorker and AppCache in the end since
// it's not most important operation and if main code fails,
// we do not want it installed
if (process.env.NODE_ENV === 'production') {
// require('offline-plugin/runtime').install(); // eslint-disable-line global-require
const runtime = require('offline-plugin/runtime');
runtime.install({
onUpdating: () => {
console.log('SW Event:', 'onUpdating');
},
onUpdateReady: () => {
console.log('SW Event:', 'onUpdateReady');
// Tells to new SW to take control immediately
runtime.applyUpdate();
},
onUpdated: () => {
console.log('SW Event:', 'onUpdated');
// Reload the webpage to load into the new version
window.location.reload();
},
onUpdateFailed: () => {
console.log('SW Event:', 'onUpdateFailed');
}
});
}
Much appreciate your help! 非常感谢您的帮助!
(Add link to a demo on https://jsfiddle.net or similar if possible) (如果可能,在https://jsfiddle.net或类似网站上添加指向演示的链接)
package.json
): 3.6.0 package.json
):3.6.0 I forgot I was using ssl-redirect for heroku deployment. 我忘记了我使用ssl-redirect进行heroku部署。
var sslRedirect = require('heroku-ssl-redirect');
// heroku enable ssl redirect
app.use(sslRedirect()); //heroku https
cheers :) 欢呼:)
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.