From 4e25a17bffb44d7577234084472cd4c770987411 Mon Sep 17 00:00:00 2001 From: Pan Date: Thu, 9 Nov 2017 18:27:00 +0800 Subject: [PATCH] fix:fix postcss config --- build/utils.js | 6 +++++- build/webpack.dev.conf.js | 4 +--- build/webpack.prod.conf.js | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/build/utils.js b/build/utils.js index b1d54b4d..e15947b1 100644 --- a/build/utils.js +++ b/build/utils.js @@ -20,9 +20,13 @@ exports.cssLoaders = function (options) { } } + var postcssLoader = { + loader: 'postcss-loader' + } + // generate loader string to be used with extract text plugin function generateLoaders (loader, loaderOptions) { - var loaders = [cssLoader] + var loaders = options.usePostCSS !== false ? [cssLoader, postcssLoader] : [cssLoader] if (loader) { loaders.push({ loader: loader + '-loader', diff --git a/build/webpack.dev.conf.js b/build/webpack.dev.conf.js index ab6d64b8..15474fb4 100644 --- a/build/webpack.dev.conf.js +++ b/build/webpack.dev.conf.js @@ -19,9 +19,7 @@ function resolveApp(relativePath) { module.exports = merge(baseWebpackConfig, { module: { - rules: utils.styleLoaders({ - sourceMap: config.dev.cssSourceMap - }) + rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) }, // cheap-source-map is faster for development devtool: '#cheap-source-map', diff --git a/build/webpack.prod.conf.js b/build/webpack.prod.conf.js index ed1947fd..d4b1cf33 100644 --- a/build/webpack.prod.conf.js +++ b/build/webpack.prod.conf.js @@ -20,7 +20,8 @@ var webpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, - extract: true + extract: true, + usePostCSS: true }) }, devtool: config.build.productionSourceMap ? '#source-map' : false,