Skip to content

Commit f97ac75

Browse files
tevcefkoistya
authored andcommitted
use HMR if available, no debug option required (kriasoft#57)
1 parent f2a4d80 commit f97ac75

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/index.js

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module.exports.pitch = function pitch(remainingRequest) {
1717
}
1818

1919
const insertCssPath = path.join(__dirname, './insertCss.js');
20-
let output = `
20+
return `
2121
var content = require(${stringifyRequest(this, `!!${remainingRequest}`)});
2222
var insertCss = require(${stringifyRequest(this, `!${insertCssPath}`)});
2323
@@ -28,9 +28,7 @@ module.exports.pitch = function pitch(remainingRequest) {
2828
module.exports = content.locals || {};
2929
module.exports._getCss = function() { return content.toString(); };
3030
module.exports._insertCss = function(options) { return insertCss(content, options) };
31-
`;
32-
33-
output += this.debug ? `
31+
3432
// Hot Module Replacement
3533
// https://webpack.github.io/docs/hot-module-replacement
3634
// Only activated in browser context
@@ -47,7 +45,5 @@ module.exports.pitch = function pitch(remainingRequest) {
4745
});
4846
module.hot.dispose(function() { removeCss(); });
4947
}
50-
` : '';
51-
52-
return output;
48+
`;
5349
};

0 commit comments

Comments
 (0)