diff --git a/lib/webpack/config.js b/lib/webpack/config.js index 1c0e4e3..5e21179 100644 --- a/lib/webpack/config.js +++ b/lib/webpack/config.js @@ -69,8 +69,7 @@ module.exports = async function() { } const extractSass = new ExtractTextPlugin({ - filename: '[name].css', - disable: isDev + filename: '[name].css' }) let config = { @@ -92,69 +91,64 @@ module.exports = async function() { rules: [ { test: /\.scss$/, - loader: extractSass.extract({ - use: [ - { - loader: 'css-loader', - options: { - minimize: !isDev, - sourceMap: isDev - } - }, - { - loader: 'postcss-loader', - options: { - sourceMap: isDev ? 'inline' : false, - plugins: loader => { - const defaultPlugins = (config = {}) => - [ - config.autoprefixer === false - ? null - : require('autoprefixer')({ - browsers: ['last 2 versions', 'IE 11'] - }), - config.lost === false ? null : require('lost'), - config['postcss-custom-media'] === false - ? null - : require('postcss-custom-media'), - config['postcss-zindex'] === false - ? null - : require('postcss-zindex'), - config['postcss-discard-duplicates'] === false - ? null - : require('postcss-discard-duplicates'), - config['postcss-unique-selectors'] === false - ? null - : require('postcss-unique-selectors'), - config['postcss-responsive-type'] === false - ? null - : require('postcss-responsive-type') - ].filter(i => i !== null) - // Allow custom PostCSS configuration - if (themeConfig.postCss) { - return themeConfig.postCss(loader, defaultPlugins) + loader: [ + 'extracted-loader', + ...extractSass.extract({ + use: [ + { + loader: 'css-loader', + options: { + minimize: !isDev, + sourceMap: isDev + } + }, + { + loader: 'postcss-loader', + options: { + sourceMap: isDev ? 'inline' : false, + plugins: loader => { + const defaultPlugins = (config = {}) => + [ + config.autoprefixer === false + ? null + : require('autoprefixer')({ + browsers: ['last 2 versions', 'IE 11'] + }), + config.lost === false ? null : require('lost'), + config['postcss-custom-media'] === false + ? null + : require('postcss-custom-media'), + config['postcss-zindex'] === false + ? null + : require('postcss-zindex'), + config['postcss-discard-duplicates'] === false + ? null + : require('postcss-discard-duplicates'), + config['postcss-unique-selectors'] === false + ? null + : require('postcss-unique-selectors'), + config['postcss-responsive-type'] === false + ? null + : require('postcss-responsive-type') + ].filter(i => i !== null) + // Allow custom PostCSS configuration + if (themeConfig.postCss) { + return themeConfig.postCss(loader, defaultPlugins) + } + + return defaultPlugins() } - - return defaultPlugins() + } + }, + { + loader: 'sass-loader', + options: { + sourceMap: isDev } } - }, - { - loader: 'sass-loader', - options: { - sourceMap: isDev - } - } - ], - // Use style-loader in development - fallback: { - loader: 'style-loader', - options: { - sourceMap: isDev, - importLoaders: 1 - } - } - }) + ] + }) + ] }, { test: /\.(jpg|png|gif)$/, diff --git a/package.json b/package.json index 01c94f5..b799e1b 100644 --- a/package.json +++ b/package.json @@ -37,8 +37,9 @@ "chalk": "^2.1.0", "cli-table": "^0.3.1", "copy-dir": "^0.3.0", - "css-loader": "^0.28.4", + "css-loader": "^0.28.10", "extract-text-webpack-plugin": "^3.0.0", + "extracted-loader": "^1.0.6", "file-loader": "^0.11.2", "find-up": "^2.1.0", "loglevel": "^1.4.1", @@ -48,17 +49,16 @@ "node-version": "^1.0.0", "postcss-custom-media": "^6.0.0", "postcss-discard-duplicates": "^2.1.0", - "postcss-loader": "^2.0.6", + "postcss-loader": "^2.1.0", "postcss-responsive-type": "^1.0.0", "postcss-unique-selectors": "^2.0.2", "postcss-zindex": "^2.2.0", "rimraf": "^2.6.1", "sass-loader": "^6.0.6", - "style-loader": "^0.18.2", "styled-jsx": "^1.0.10", "svg-spritemap-webpack-plugin": "^1.0.3", "svgo-loader": "^1.2.1", - "webpack": "^3.5.5", + "webpack": "^3.11.0", "webpack-dev-server": "^2.6.0", "webpack-format-messages": "^1.0.0" }, diff --git a/yarn.lock b/yarn.lock index dccab34..9e5fe5d 100644 --- a/yarn.lock +++ b/yarn.lock @@ -41,9 +41,9 @@ ajv-keywords@^1.0.0: version "1.5.1" resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-1.5.1.tgz#314dd0a4b3368fad3dfcdc54ede6171b886daf3c" -ajv-keywords@^2.0.0: - version "2.1.0" - resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-2.1.0.tgz#a296e17f7bfae7c1ce4f7e0de53d29cb32162df0" +ajv-keywords@^3.1.0: + version "3.1.0" + resolved "https://registry.yarnpkg.com/ajv-keywords/-/ajv-keywords-3.1.0.tgz#ac2b27939c543e95d2c06e7f7f5c27be4aa543be" ajv@^4.7.0, ajv@^4.9.1: version "4.11.8" @@ -52,7 +52,7 @@ ajv@^4.7.0, ajv@^4.9.1: co "^4.6.0" json-stable-stringify "^1.0.1" -ajv@^5.0.0, ajv@^5.1.5: +ajv@^5.0.0: version "5.2.2" resolved "https://registry.yarnpkg.com/ajv/-/ajv-5.2.2.tgz#47c68d69e86f5d953103b0074a9430dc63da5e39" dependencies: @@ -61,6 +61,14 @@ ajv@^5.0.0, ajv@^5.1.5: json-schema-traverse "^0.3.0" json-stable-stringify "^1.0.1" +ajv@^6.1.0: + version "6.1.1" + resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.1.1.tgz#978d597fbc2b7d0e5a5c3ddeb149a682f2abfa0e" + dependencies: + fast-deep-equal "^1.0.0" + fast-json-stable-stringify "^2.0.0" + json-schema-traverse "^0.3.0" + align-text@^0.1.1, align-text@^0.1.3: version "0.1.4" resolved "https://registry.yarnpkg.com/align-text/-/align-text-0.1.4.tgz#0cd90a561093f35d0a99256c22b7069433fad117" @@ -103,7 +111,7 @@ ansi-styles@^2.2.1: version "2.2.1" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-2.2.1.tgz#b432dd3358b634cf75e1e4664368240533c1ddbe" -ansi-styles@^3.1.0: +ansi-styles@^3.1.0, ansi-styles@^3.2.0: version "3.2.0" resolved "https://registry.yarnpkg.com/ansi-styles/-/ansi-styles-3.2.0.tgz#c159b8d5be0f9e5a6f346dab94f16ce022161b88" dependencies: @@ -259,7 +267,7 @@ aws4@^1.2.1: version "1.6.0" resolved "https://registry.yarnpkg.com/aws4/-/aws4-1.6.0.tgz#83ef5ca860b2b32e4a0deedee8c771b9db57471e" -babel-code-frame@^6.11.0, babel-code-frame@^6.16.0, babel-code-frame@^6.20.0, babel-code-frame@^6.26.0: +babel-code-frame@^6.16.0, babel-code-frame@^6.20.0, babel-code-frame@^6.26.0: version "6.26.0" resolved "https://registry.yarnpkg.com/babel-code-frame/-/babel-code-frame-6.26.0.tgz#63fd43f7dc1e3bb7ce35947db8fe369a3f58c74b" dependencies: @@ -1130,6 +1138,14 @@ chalk@^2.0.1, chalk@^2.1.0: escape-string-regexp "^1.0.5" supports-color "^4.0.0" +chalk@^2.3.1: + version "2.3.1" + resolved "https://registry.yarnpkg.com/chalk/-/chalk-2.3.1.tgz#523fe2678aec7b04e8041909292fe8b17059b796" + dependencies: + ansi-styles "^3.2.0" + escape-string-regexp "^1.0.5" + supports-color "^5.2.0" + chokidar@^1.6.0, chokidar@^1.7.0: version "1.7.0" resolved "https://registry.yarnpkg.com/chokidar/-/chokidar-1.7.0.tgz#798e689778151c8076b4b360e5edd28cda2bb468" @@ -1515,22 +1531,22 @@ css-color-names@0.0.4: version "0.0.4" resolved "https://registry.yarnpkg.com/css-color-names/-/css-color-names-0.0.4.tgz#808adc2e79cf84738069b646cb20ec27beb629e0" -css-loader@^0.28.4: - version "0.28.7" - resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.7.tgz#5f2ee989dd32edd907717f953317656160999c1b" +css-loader@^0.28.10: + version "0.28.10" + resolved "https://registry.yarnpkg.com/css-loader/-/css-loader-0.28.10.tgz#40282e79230f7bcb4e483efa631d670b735ebf42" dependencies: - babel-code-frame "^6.11.0" + babel-code-frame "^6.26.0" css-selector-tokenizer "^0.7.0" - cssnano ">=2.6.1 <4" + cssnano "^3.10.0" icss-utils "^2.1.0" loader-utils "^1.0.2" lodash.camelcase "^4.3.0" - object-assign "^4.0.1" + object-assign "^4.1.1" postcss "^5.0.6" - postcss-modules-extract-imports "^1.0.0" - postcss-modules-local-by-default "^1.0.1" - postcss-modules-scope "^1.0.0" - postcss-modules-values "^1.1.0" + postcss-modules-extract-imports "^1.2.0" + postcss-modules-local-by-default "^1.2.0" + postcss-modules-scope "^1.1.0" + postcss-modules-values "^1.3.0" postcss-value-parser "^3.3.0" source-list-map "^2.0.0" @@ -1552,7 +1568,7 @@ cssesc@^0.1.0: version "0.1.0" resolved "https://registry.yarnpkg.com/cssesc/-/cssesc-0.1.0.tgz#c814903e45623371a0477b40109aaafbeeaddbb4" -"cssnano@>=2.6.1 <4": +cssnano@^3.10.0: version "3.10.0" resolved "https://registry.yarnpkg.com/cssnano/-/cssnano-3.10.0.tgz#4f38f6cea2b9b17fa01490f23f1dc68ea65c1c38" dependencies: @@ -2217,6 +2233,10 @@ extract-text-webpack-plugin@^3.0.0: schema-utils "^0.3.0" webpack-sources "^1.0.1" +extracted-loader@^1.0.6: + version "1.0.6" + resolved "https://registry.yarnpkg.com/extracted-loader/-/extracted-loader-1.0.6.tgz#df214c4062e6c75a19056ca64d003a2cc4c7d13e" + extsprintf@1.3.0, extsprintf@^1.2.0: version "1.3.0" resolved "https://registry.yarnpkg.com/extsprintf/-/extsprintf-1.3.0.tgz#96918440e3041a7a414f8c52e3c574eb3c3e1e05" @@ -2225,6 +2245,10 @@ fast-deep-equal@^1.0.0: version "1.0.0" resolved "https://registry.yarnpkg.com/fast-deep-equal/-/fast-deep-equal-1.0.0.tgz#96256a3bc975595eb36d82e9929d060d893439ff" +fast-json-stable-stringify@^2.0.0: + version "2.0.0" + resolved "https://registry.yarnpkg.com/fast-json-stable-stringify/-/fast-json-stable-stringify-2.0.0.tgz#d5142c0caee6b1189f87d3a76111064f86c8bbf2" + fast-levenshtein@~2.0.4: version "2.0.6" resolved "https://registry.yarnpkg.com/fast-levenshtein/-/fast-levenshtein-2.0.6.tgz#3d8a5c66883a16a30ca8643e851f19baa7797917" @@ -2565,6 +2589,10 @@ has-flag@^2.0.0: version "2.0.0" resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-2.0.0.tgz#e8207af1cc7b30d446cc70b734b5e8be18f88d51" +has-flag@^3.0.0: + version "3.0.0" + resolved "https://registry.yarnpkg.com/has-flag/-/has-flag-3.0.0.tgz#b5d454dc2199ae225699f3467e5a07f3b955bafd" + has-unicode@^2.0.0: version "2.0.1" resolved "https://registry.yarnpkg.com/has-unicode/-/has-unicode-2.0.1.tgz#e0e6fe6a28cf51138855e086d1691e771de2a8b9" @@ -3778,7 +3806,7 @@ obj-props@^1.0.0: version "1.1.0" resolved "https://registry.yarnpkg.com/obj-props/-/obj-props-1.1.0.tgz#626313faa442befd4a44e9a02c3cb6bde937b511" -object-assign@^4.0.1, object-assign@^4.1.0: +object-assign@^4.0.1, object-assign@^4.1.0, object-assign@^4.1.1: version "4.1.1" resolved "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz#2109adc7965887cfc05cbbd442cac8bfbb360863" @@ -4152,14 +4180,14 @@ postcss-load-plugins@^2.3.0: cosmiconfig "^2.1.1" object-assign "^4.1.0" -postcss-loader@^2.0.6: - version "2.0.6" - resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.0.6.tgz#8c7e0055a3df1889abc6bad52dd45b2f41bbc6fc" +postcss-loader@^2.1.0: + version "2.1.0" + resolved "https://registry.yarnpkg.com/postcss-loader/-/postcss-loader-2.1.0.tgz#038c2d6d59753fef4667827fd3ae03f5dc5e6a7a" dependencies: loader-utils "^1.1.0" - postcss "^6.0.2" + postcss "^6.0.0" postcss-load-config "^1.2.0" - schema-utils "^0.3.0" + schema-utils "^0.4.0" postcss-merge-idents@^2.1.5: version "2.1.7" @@ -4222,27 +4250,27 @@ postcss-minify-selectors@^2.0.4: postcss "^5.0.14" postcss-selector-parser "^2.0.0" -postcss-modules-extract-imports@^1.0.0: +postcss-modules-extract-imports@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/postcss-modules-extract-imports/-/postcss-modules-extract-imports-1.2.0.tgz#66140ecece38ef06bf0d3e355d69bf59d141ea85" dependencies: postcss "^6.0.1" -postcss-modules-local-by-default@^1.0.1: +postcss-modules-local-by-default@^1.2.0: version "1.2.0" resolved "https://registry.yarnpkg.com/postcss-modules-local-by-default/-/postcss-modules-local-by-default-1.2.0.tgz#f7d80c398c5a393fa7964466bd19500a7d61c069" dependencies: css-selector-tokenizer "^0.7.0" postcss "^6.0.1" -postcss-modules-scope@^1.0.0: +postcss-modules-scope@^1.1.0: version "1.1.0" resolved "https://registry.yarnpkg.com/postcss-modules-scope/-/postcss-modules-scope-1.1.0.tgz#d6ea64994c79f97b62a72b426fbe6056a194bb90" dependencies: css-selector-tokenizer "^0.7.0" postcss "^6.0.1" -postcss-modules-values@^1.1.0: +postcss-modules-values@^1.3.0: version "1.3.0" resolved "https://registry.yarnpkg.com/postcss-modules-values/-/postcss-modules-values-1.3.0.tgz#ecffa9d7e192518389f42ad0e83f72aec456ea20" dependencies: @@ -4344,7 +4372,15 @@ postcss@^5.0.10, postcss@^5.0.11, postcss@^5.0.12, postcss@^5.0.13, postcss@^5.0 source-map "^0.5.6" supports-color "^3.2.3" -postcss@^6.0.1, postcss@^6.0.10, postcss@^6.0.2, postcss@^6.0.6: +postcss@^6.0.0: + version "6.0.19" + resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.19.tgz#76a78386f670b9d9494a655bf23ac012effd1555" + dependencies: + chalk "^2.3.1" + source-map "^0.6.1" + supports-color "^5.2.0" + +postcss@^6.0.1, postcss@^6.0.10, postcss@^6.0.6: version "6.0.10" resolved "https://registry.yarnpkg.com/postcss/-/postcss-6.0.10.tgz#c311b89734483d87a91a56dc9e53f15f4e6e84e4" dependencies: @@ -4793,6 +4829,13 @@ schema-utils@^0.3.0: dependencies: ajv "^5.0.0" +schema-utils@^0.4.0: + version "0.4.5" + resolved "https://registry.yarnpkg.com/schema-utils/-/schema-utils-0.4.5.tgz#21836f0608aac17b78f9e3e24daff14a5ca13a3e" + dependencies: + ajv "^6.1.0" + ajv-keywords "^3.1.0" + scss-tokenizer@^0.2.3: version "0.2.3" resolved "https://registry.yarnpkg.com/scss-tokenizer/-/scss-tokenizer-0.2.3.tgz#8eb06db9a9723333824d3f5530641149847ce5d1" @@ -4982,6 +5025,10 @@ source-map@^0.5.3, source-map@^0.5.6, source-map@^0.5.7, source-map@~0.5.1, sour version "0.5.7" resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.5.7.tgz#8a039d2d1021d22d1ea14c80d8ea468ba2ef3fcc" +source-map@^0.6.1: + version "0.6.1" + resolved "https://registry.yarnpkg.com/source-map/-/source-map-0.6.1.tgz#74722af32e9614e9c287a8d0bbde48b5e2f1a263" + spdx-correct@~1.0.0: version "1.0.2" resolved "https://registry.yarnpkg.com/spdx-correct/-/spdx-correct-1.0.2.tgz#4b3073d933ff51f3912f03ac5519498a4150db40" @@ -5149,13 +5196,6 @@ strip-json-comments@~2.0.1: version "2.0.1" resolved "https://registry.yarnpkg.com/strip-json-comments/-/strip-json-comments-2.0.1.tgz#3c531942e908c2697c0ec344858c286c7ca0a60a" -style-loader@^0.18.2: - version "0.18.2" - resolved "https://registry.yarnpkg.com/style-loader/-/style-loader-0.18.2.tgz#cc31459afbcd6d80b7220ee54b291a9fd66ff5eb" - dependencies: - loader-utils "^1.0.2" - schema-utils "^0.3.0" - styled-jsx@^1.0.10: version "1.0.10" resolved "https://registry.yarnpkg.com/styled-jsx/-/styled-jsx-1.0.10.tgz#114eea6ff5ae8f54bc2bcda86d2861085d5c99dd" @@ -5191,6 +5231,12 @@ supports-color@^4.0.0, supports-color@^4.2.1: dependencies: has-flag "^2.0.0" +supports-color@^5.2.0: + version "5.2.0" + resolved "https://registry.yarnpkg.com/supports-color/-/supports-color-5.2.0.tgz#b0d5333b1184dd3666cbe5aa0b45c5ac7ac17a4a" + dependencies: + has-flag "^3.0.0" + svg-spritemap-webpack-plugin@^1.0.3: version "1.0.3" resolved "https://registry.yarnpkg.com/svg-spritemap-webpack-plugin/-/svg-spritemap-webpack-plugin-1.0.3.tgz#2e147ab5452f37e3d2d692dbd9dfb237cdc141c0" @@ -5606,14 +5652,14 @@ webpack-sources@^1.0.1: source-list-map "^2.0.0" source-map "~0.5.3" -webpack@^3.5.5: - version "3.5.5" - resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.5.5.tgz#3226f09fc8b3e435ff781e7af34f82b68b26996c" +webpack@^3.11.0: + version "3.11.0" + resolved "https://registry.yarnpkg.com/webpack/-/webpack-3.11.0.tgz#77da451b1d7b4b117adaf41a1a93b5742f24d894" dependencies: acorn "^5.0.0" acorn-dynamic-import "^2.0.0" - ajv "^5.1.5" - ajv-keywords "^2.0.0" + ajv "^6.1.0" + ajv-keywords "^3.1.0" async "^2.1.2" enhanced-resolve "^3.4.0" escope "^3.6.0"