diff --git a/.npmignore b/.npmignore index e8add85..ad29248 100755 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,3 @@ -src tests coverage .* diff --git a/package.json b/package.json index 9a49f02..3cb7bf1 100644 --- a/package.json +++ b/package.json @@ -45,6 +45,7 @@ "scripts": { "lint": "eslint ./src ./tests", "test": "mocha --compilers js:babel-register ./tests/**/*.js", + "postinstall": "npm install --ignore-scripts && babel ./src --out-dir ./dist", "build": "babel ./src --out-dir ./dist" } } diff --git a/src/generateAppendClassName.js b/src/generateAppendClassName.js index c896f6e..cdc97ad 100644 --- a/src/generateAppendClassName.js +++ b/src/generateAppendClassName.js @@ -4,6 +4,7 @@ const stylesIndex = new Map(); export default (styles, styleNames: Array, errorWhenNotFound: boolean): string => { let appendClassName, + key, stylesIndexMap; stylesIndexMap = stylesIndex.get(styles); @@ -15,7 +16,14 @@ export default (styles, styleNames: Array, errorWhenNotFound: boolean): return styleNameIndex; } } else { - stylesIndexMap = stylesIndex.set(styles, new Map()); + stylesIndex.set(styles, new Map()); + stylesIndexMap = new Map(); + + for (key in stylesIndex) { + if (stylesIndex.hasOwnProperty(key)) { + stylesIndexMap.set(key, stylesIndex[key]); + } + } } appendClassName = '';