Skip to content

Commit

Permalink
refactor: restore hmr for lazy styles after refactor
Browse files Browse the repository at this point in the history
  • Loading branch information
alexander-akait committed Aug 5, 2019
1 parent 3824f83 commit adb9c31
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,8 @@ if (module.hot) {
var lastRefs = module.hot.data && module.hot.data.refs || 0;
if (lastRefs) {
exports.ref();
exports.use();
if (!content.locals) {
refs = lastRefs;
}
Expand Down Expand Up @@ -94,8 +95,13 @@ var options = ${JSON.stringify(options)};
options.insert = ${insert};
options.singleton = ${isSingleton};
if (typeof content === 'string') content = [[module.id, content, '']];
if (content.locals) exports.locals = content.locals;
if (typeof content === 'string') {
content = [[module.id, content, '']];
}
if (content.locals) {
exports.locals = content.locals;
}
exports.use = function() {
if (!(refs++)) {
Expand Down Expand Up @@ -171,8 +177,6 @@ if (module.hot) {
if (typeof content === 'string') content = [[module.id, content, '']];
var insertInto;
var options = ${JSON.stringify(options)}
options.insert = ${insert};
Expand Down

0 comments on commit adb9c31

Please sign in to comment.