Skip to content

Commit

Permalink
fix: broken hot reloading of global styles (#150)
Browse files Browse the repository at this point in the history
* fix: broken hot reloading of global styles

if local scoped hash maps were not returned, the loader was not adding HMR to the file at all.

* fix: resetting package version

resetting npm version back to 0.0.0-development for semantic releases
  • Loading branch information
ScriptedAlchemy committed Mar 11, 2019
1 parent a522101 commit 7d4b725
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion package.json
@@ -1,6 +1,6 @@
{
"name": "extract-css-chunks-webpack-plugin",
"version": "4.0.0-beta.2",
"version": "0.0.0-development",
"description": "Extract CSS from chunks into stylesheets + HMR. Supports Webpack 4 + SSR",
"license": "MIT",
"author": "James Gillmore <james@faceyspacey.com>",
Expand Down
13 changes: 7 additions & 6 deletions src/loader.js
Expand Up @@ -150,12 +150,13 @@ export function pitch(request) {
return callback(e);
}
let resultSource = `// extracted by ${pluginName}`;
if (locals && typeof resultSource !== 'undefined') {
const result = `\nmodule.exports = ${JSON.stringify(locals)};`;
resultSource += query.hot
? hotLoader(result, { context: this.context, query })
: '';
}
const result = locals
? `\nmodule.exports = ${JSON.stringify(locals)};`
: '';

resultSource += query.hot
? hotLoader(result, { context: this.context, query })
: '';

return callback(null, resultSource);
});
Expand Down
2 changes: 1 addition & 1 deletion test/cases/hmr/expected/main.js
Expand Up @@ -88,7 +88,7 @@
/* 0 */
/***/ (function(module, exports, __webpack_require__) {

// extracted by mini-css-extract-plugin
// extracted by extract-css-chunks-webpack-plugin

/***/ })
/******/ ]);

0 comments on commit 7d4b725

Please sign in to comment.