【发布时间】:2019-03-31 10:23:51
【问题描述】:
https://github.com/react-boilerplate/react-boilerplate
说明
运行 yarn run build 后, 纱线开始:产品 它说它正在终端窗口上运行,但是, 当我转到 http://localhost:3000 时,网址突然变为 => https://localhost/ 并说 无法访问此站点 localhost 拒绝连接。
开发模式 yarn start 工作正常
重现步骤
我按照 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 或类似网站上添加演示链接)
版本
- React-Boilerplate(参见
package.json):3.6.0 - 节点/NPM:v9.11.1
- 浏览器:chrome
【问题讨论】:
标签: node.js reactjs webpack feathersjs react-boilerplate