lvarayut / relay-fullstack

:point_up::running: Modern Relay Starter Kit - Integrated with Relay, GraphQL, Express, ES6/ES7, JSX, Webpack, Babel, Material Design Lite, and PostCSS
https://lvarayut.github.io/relay-fullstack/
MIT License
985 stars 126 forks source link

Updates webpack@2.2.0 #61

Closed ncrmro closed 7 years ago

ncrmro commented 7 years ago
lvarayut commented 7 years ago

Thanks @ncrmro for this great PR 👍

ncrmro commented 7 years ago

@lvarayut no problem, this project is great!

I think HMR has a slightly different config now, whoops!

Working on getting something together it looks like a few changes. https://webpack.js.org/guides/hmr-react/#project-config

// ./src/index.js
import React from 'react';
import ReactDOM from 'react-dom';

import { AppContainer } from 'react-hot-loader';
// AppContainer is a necessary wrapper component for HMR

import App from './components/App';

const render = (Component) => {
  ReactDOM.render(
    <AppContainer>
      <Component/>
    </AppContainer>,
    document.getElementById('root')
  );
};

render(App);

// Hot Module Replacement API
if (module.hot) {
  module.hot.accept('./components/App', () => {
    render(App)
  });
}
lvarayut commented 7 years ago

That's interesting. Please don't hesitate to send an awesome PR again :)