react hot transformer for ts,and no babel
MIT License
react hot transformer for ts,and no babel
ts-loader
npm install --save-dev ts-react-hot-transformer react-hot-loader
ts-react-hot-transformer
to your ts-loader
options:// webpack.config.js
const tsReactHotTransformer = require('ts-react-hot-transformer')
module.exports = {
// ...
module: {
rules: [
{
test: /\.(jsx|tsx|js|ts)$/,
loader: 'ts-loader',
options: {
getCustomTransformers: () => ({
before: [ tsReactHotTransformer() ]
}),
},
exclude: /node_modules/
}
]
},
// ...
}
// App.js
import { hot } from 'react-hot-loader/root'
const App = () => <div>Hello World!</div>
export default hot(App)
webpack-dev-server --hot
It is the same React-Dom, with the same version, to hot patch.
There is 2 ways to install it:
@hot-loader/react-dom
installed instead of react-dom
yarn add @hot-loader/react-dom
// webpack.conf
...
resolve: {
alias: {
'react-dom': '@hot-loader/react-dom'
}
}
...