babel-plugin-remove-module-hot
v2.0.0
Published
Remove `module.hot` conditions
Downloads
5
Readme
babel-plugin-remove-module-hot
Remove module.hot
conditions.
Example
in
console.log('Do something always');
if (module.hot) {
console.log('Do something, when hot reload available');
}
if (module.hot) {
console.log('Do something, when hot reload available');
} else {
console.log('Do something, when hot reload unavailable');
}
if (!module.hot) {
console.log('Do something, when hot reload unavailable');
}
const variable = module.hot ? 'hot' : 'not hot';
out
console.log('Do something always');
if (true) {
console.log('Do something, when hot reload unavailable');
}
if (!module.hot) {
console.log('Do something, when hot reload unavailable');
}
const variable = 'not hot';
Warning
This plugin removes only simple condition like in example, and doesn't process more complex expressions.
Installation
$ npm install babel-plugin-remove-module-hot
Usage
Via .babelrc
(Recommended)
.babelrc
{
"plugins": ["remove-module-hot"]
}
Via CLI
$ babel --plugins remove-module-hot script.js
Via Node API
require('babel-core').transform('code', {
plugins: ['remove-module-hot']
});