https://github.com/react-boilerplate/react-boilerplate
运行yarn run build之后, 纱线开始:产品 它说它正在终端窗口上运行,但是, 当我转到http://localhost:3000时,网址突然变为=> https://localhost/并说 无法访问此站点本地主机拒绝连接。
开发模式纱线启动正常
我按照指南从react-boilerplate中的一个问题中删除了ImmutableJS。
我添加了feathersJS后端,前端。
我在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" }]
],
},
},
},
我更改了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');
}
});
}
非常感谢您的帮助!
(如果可能,在https://jsfiddle.net或类似位置添加演示链接)
package.json
):3.6.0 答案 0 :(得分:0)
我忘记了我使用ssl-redirect进行heroku部署。
var sslRedirect = require('heroku-ssl-redirect');
// heroku enable ssl redirect
app.use(sslRedirect()); //heroku https
欢呼:)