Skip to content
This repository has been archived by the owner on Mar 12, 2020. It is now read-only.

Storybooks isn't reloading the view via HMR #555

Closed
orta opened this issue May 22, 2017 · 13 comments
Closed

Storybooks isn't reloading the view via HMR #555

orta opened this issue May 22, 2017 · 13 comments

Comments

@orta
Copy link
Contributor

orta commented May 22, 2017

You can't press save and see the changes, you'd need to change between different stories. The HMRer is definitely doing it's work, you can see the notification - it's just that the storybook's content doesn't get updated.

Storybooks 3.0 is coming out soon, perhaps we can try that if a simple yarn upgrade [storybooks] doesn't help

@orta
Copy link
Contributor Author

orta commented May 22, 2017

This is what I mean by proof:

screen shot 2017-05-22 at 13 40 20

@orta
Copy link
Contributor Author

orta commented May 24, 2017

I updated storybooks to 3.0.0 and don't see HMR changes to our views inside storybooks.

The same type of changes work fine inside the app.

@orta
Copy link
Contributor Author

orta commented May 24, 2017

Look a look at the default settings inside storybooks-rn: https://github.com/storybooks/storybook/blob/master/app/react-native/src/server/config/webpack.config.js

Changing out config to

const path = require('path')
const webpack = require('webpack')

const { OccurenceOrderPlugin, includePaths, excludePaths } = require('@storybook/react-native/dist/server/config/utils')

module.exports = {
  devtool: "#inline-source-map", // Otherwise getting errors about e.g. `Relay` not being defined.
  resolve: {
    extensions: [".js", ".jsx", ".ts", ".tsx"],
  },
  module: {
    loaders: [
      {
        test: /\.tsx?$/,
        exclude: /node_modules/,
        loaders: ["awesome-typescript-loader?configFileName=./tsconfig.json&silent=true&transpileOnly=true&target=es6&useBabel=true&useCache=true"],
      },
    ],
  },
  plugins: [
    new OccurenceOrderPlugin(),
    new webpack.HotModuleReplacementPlugin(),
  ],
}

Didn't help - think that might only work for the server anyway.

@orta
Copy link
Contributor Author

orta commented May 24, 2017

#562 could help a bit here

@orta
Copy link
Contributor Author

orta commented Jun 7, 2017

This works for maxim

🌊

@orta
Copy link
Contributor Author

orta commented Jun 9, 2017

We discovered that live reloading works for maxim, not HMR

@orta
Copy link
Contributor Author

orta commented Jun 12, 2017

This works for me, in storybooks, on the Welcome page when I make changes to the text

@orta
Copy link
Contributor Author

orta commented Jun 12, 2017

Got it - a PureComponent does not get HMR

@alloy
Copy link
Contributor

alloy commented Jun 12, 2017

Sigh. Are there docs for that?

@orta
Copy link
Contributor Author

orta commented Jun 12, 2017

@alloy
Copy link
Contributor

alloy commented Jun 12, 2017

Ok. Alas that doesn’t really tell me much more about the details :/

@alloy
Copy link
Contributor

alloy commented Jun 13, 2017

This is done in #611.

@orta
Copy link
Contributor Author

orta commented Oct 20, 2017

gaearon/babel-plugin-react-transform#106 should actively fix this vs our workaround

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

2 participants