Skip to content

Commit

Permalink
refactor: remove HMR relative code
Browse files Browse the repository at this point in the history
BREAKING CHANGE: `setConfig` is no longer available.
  • Loading branch information
gregberge committed May 5, 2018
1 parent fff1248 commit ef0817c
Show file tree
Hide file tree
Showing 5 changed files with 1 addition and 32 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -342,14 +342,7 @@ window.snapSaveState = () => getState()

### Hot Reloading

Loadable Components is Hot Reload friendly, it works out of the box with [React Hot Loader](https://github.com/gaearon/react-hot-loader) without adding a single line of code. All components are loaded when a reload occurs, if you want to disable this behaviour, you can set a global config:

```js
import { setConfig } from 'loadable-components'

// Disable automatic "load" of components
setConfig({ hotReload: false })
```
Loadable Components is Hot Reload friendly, it works out of the box with [React Hot Loader](https://github.com/gaearon/react-hot-loader).

## API Reference

Expand Down
9 changes: 0 additions & 9 deletions src/config.js

This file was deleted.

9 changes: 0 additions & 9 deletions src/config.test.js

This file was deleted.

1 change: 0 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,4 @@ export { default as loadComponents } from './loadComponents'
export { default as getState } from './getState'
export { LOADABLE } from './constants'
export { default } from './loadable'
export { setConfig } from './config'
export const componentTracker = tracker
5 changes: 0 additions & 5 deletions src/loadable.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import hoistNonReactStatics from 'hoist-non-react-statics'
import { LOADABLE } from './constants'
import resolveModuleDefault from './utils/resolveModuleDefault'
import * as componentTracker from './componentTracker'
import { getConfig } from './config'

const EmptyComponent = () => null

Expand Down Expand Up @@ -107,10 +106,6 @@ function loadable(

LoadableComponent[LOADABLE] = () => LoadableComponent

if (module && module.hot && getConfig().hotReload) {
LoadableComponent.load()
}

if (modules) {
const id = componentTracker.track(LoadableComponent, modules)
LoadableComponent.componentId = id
Expand Down

0 comments on commit ef0817c

Please sign in to comment.