diff --git a/template/build/utils.js b/template/build/utils.js index 4ac71cb2c9..f8efbeb001 100644 --- a/template/build/utils.js +++ b/template/build/utils.js @@ -21,9 +21,13 @@ exports.cssLoaders = function (options) { } } + var postcssLoader = { + loader: 'postcss-loader' + } + // generate loader string to be used with extract text plugin function generateLoaders (loader, loaderOptions) { - const loaders = [cssLoader] + const loaders = options.usePostCSS !== false ? [cssLoader, postcssLoader] : [cssLoader] if (loader) { loaders.push({ loader: loader + '-loader', diff --git a/template/build/webpack.dev.conf.js b/template/build/webpack.dev.conf.js index 6f25d63458..09c6d8159e 100644 --- a/template/build/webpack.dev.conf.js +++ b/template/build/webpack.dev.conf.js @@ -14,7 +14,7 @@ Object.keys(baseWebpackConfig.entry).forEach(function (name) { module.exports = merge(baseWebpackConfig, { module: { - rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap }) + rules: utils.styleLoaders({ sourceMap: config.dev.cssSourceMap, usePostCSS: true }) }, // cheap-module-eval-source-map is faster for development devtool: '#cheap-module-eval-source-map', diff --git a/template/build/webpack.prod.conf.js b/template/build/webpack.prod.conf.js index 1b91741c2d..1b29539b62 100644 --- a/template/build/webpack.prod.conf.js +++ b/template/build/webpack.prod.conf.js @@ -18,7 +18,8 @@ const webpackConfig = merge(baseWebpackConfig, { module: { rules: utils.styleLoaders({ sourceMap: config.build.productionSourceMap, - extract: true + extract: true, + usePostCSS: true }) }, devtool: config.build.productionSourceMap ? '#source-map' : false,