0

https://github.com/react-boilerplate/react-boilerplate

Description

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.

development mode yarn start works fine

Steps to reproduce

I removed ImmutableJS following the guide from one of the issues in react-boilerplate.

I added feathersJS backend, frontend.

I changed babel-loader in webpack.base.babel.js to

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

// 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)

Versions

  • React-Boilerplate (see package.json): 3.6.0
  • Node/NPM: v9.11.1
  • Browser: chrome

1 Answers1

0

I forgot I was using ssl-redirect for heroku deployment.

var sslRedirect = require('heroku-ssl-redirect');
// heroku enable ssl redirect
app.use(sslRedirect()); //heroku https

cheers :)