Skip to content

Commit 4b6db63

Browse files
authored
Update themr.js
when the source style is empty / contain only :global rules, `extract-text-webpack-plugin` put string instead of json, which break the merge. this if prevent this specific case javivelasco/react-css-themr#66
1 parent bb0da20 commit 4b6db63

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/components/themr.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,13 @@ function merge(original = {}, mixin = {}) {
222222
switch (typeof originalValue) {
223223
case 'object': {
224224
//can't merge a non-object with an object
225+
if (mixinValue === '// removed by extract-text-webpack-plugin') {
226+
// when the source style is empty / contain only :global rules,
227+
// extract-text-webpack-plugin put string instead of json, which break the merge.
228+
// this if prevent this specific case
229+
// https://github.com/javivelasco/react-css-themr/issues/66
230+
break;
231+
}
225232
throw new Error(`You are merging non-object ${mixinValue} with an object ${key}`)
226233
}
227234

0 commit comments

Comments
 (0)