2.0.0 • Published 10 years ago
babel-plugin-remove-module-hot v2.0.0
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-hotUsage
Via .babelrc (Recommended)
.babelrc
{
"plugins": ["remove-module-hot"]
}Via CLI
$ babel --plugins remove-module-hot script.jsVia Node API
require('babel-core').transform('code', {
plugins: ['remove-module-hot']
});