Description
Do you want to request a feature or report a bug?
Bug
What is the current behavior?
The output always has the following template (source code in index.js):
// Hot Module Replacement
if(false) {
// When the styles change, update the <style> tags
if(!content.locals) {
module.hot.accept("!!../node_modules/some-npm-registry/postcss-loader/2.0.6/node_modules/postcss-loader/lib/index.js!./myComponent.pcss", function() {
var newContent = require("!!../node_modules/some-npm-registry/postcss-loader/2.0.6/node_modules/postcss-loader/lib/index.js!./myComponent.pcss");
if(typeof newContent === 'string') newContent = [[module.id, newContent, '']];
update(newContent);
});
}
// When the module is disposed, remove the <style> tags
module.hot.dispose(function() { update(); });
}
And this block is useless in prod because it will never be run with if (false)
while HMR is off. But the problem is that the "!!../node_modules/some-npm-registry/postcss-loader/2.0.6/node_modules/postcss-loader/lib/index.js!./myComponent.pcss"
is always being output in the dist file and breaks other bundling tools such as JSPM/SystemJS doing a static verification on the file path, the file path is only for local development and never been exported to dist.
If the current behavior is a bug, please provide the steps to reproduce.
The above HMR code block is always being generated in the final output.
What is the expected behavior?
The style-loader should introduce an option to not output this block if this flag is false, so that we could pass in the environmental flags. I would like to send a pull request for this and just wanted to make sure there's no side effect to just avoid outputting this block for production distribution when HMR is not needed.
If this is a feature request, what is motivation or use case for changing the behavior?
Please mention other relevant information such as your webpack version, Node.js version and Operating System.