一个新的Webpack样板文件:React Transform Boilerplate
ygp8
9年前
一个新Webpack样板文件包括:
- 热加载React 组件;
- 错误处理在componentrender()function内部;
- error handling for syntax errors (thanks, @glenjamin!)
Built with babel-plugin-react-transform and a few custom transforms.
Does not use React Hot Loader.
Demo
git clone https://github.com/gaearon/react-transform-boilerplate.git cd react-transform-boilerplate npm install npm start open http://localhost:3000
Then go ahead and edit files insidesrc(any file exceptindex.js).
What’s Inside
The component instrumentation is implemented on top of babel-plugin-react-transform:
- react-transform-webpack-hmr handles hot reloading
- react-transform-catch-errors catches component errors
The syntax errors are displayed in an overlay by @glenjamin’s webpack-hot-middleware which replaces Webpack Dev Server.