Skip to content

Inject hot reload variables? #34

@peteruithoven

Description

@peteruithoven

Webpack works with module.hot variables in modules. See: https://webpack.github.io/docs/hot-module-replacement.html
Having such variables would make some things seriously easier.

For Redux for example, the code in the following gist: https://gist.github.com/peteruithoven/59f188bfab035ce96948
Could turn into something like:

import {createStore} from 'redux';
import reducer from './reducers/index.js'
import { rehydrate, rehydratingStore } from './utils/rehydratingStore.js';
let initialState;
if(__hot) {
  initialState = __hot.deletedModule;
}
const store = rehydratingStore()(createStore)(reducer, initialState);

Would it be possible to "inject" such variables into hot reloaded modules?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions