Skip to content

Instantly share code, notes, and snippets.

@alexeyraspopov
Last active August 23, 2016 08:51
Show Gist options
  • Save alexeyraspopov/5d5587ff5d1344f75c24 to your computer and use it in GitHub Desktop.
Save alexeyraspopov/5d5587ff5d1344f75c24 to your computer and use it in GitHub Desktop.
Watchify + React + HMR
{
"env": {
"development": {
"plugins": ["react-transform"],
"extra": {
"react-transform": {
"transforms": [{
"transform": "react-transform-hmr",
"imports": ["react"],
"locals": ["module"]
}]
}
}
}
}
}
{
"name": "name",
"version": "0.0.0",
"dependencies": {
"react": "~0.14.6",
"react-dom": "~0.14.6"
},
"devDependencies": {
"babel": "5.8.34",
"babel-plugin-react-transform": "1.1.1",
"babelify": "6.4.0",
"browserify": "~13.0.0",
"browserify-hmr": "0.3.1",
"react-transform-hmr": "1.0.1",
"watchify": "~3.7.0"
}
}
browserify -r react -r react-dom -o dist/vendor.js
watchify -e index.web.js \
-x react -x react-dom \
-t [ babelify --sourceMapRelative . ] \
-p browserify-hmr \
-o dist/bundle.js -dv
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment