From 8f326bb6e6702bd9d5d635a4f8c94509fa7f1388 Mon Sep 17 00:00:00 2001 From: xsdlr Date: Thu, 7 Sep 2017 16:30:25 +0800 Subject: [PATCH] use postcss.config.js to config postcss plugin --- .../custom-react-scripts/webpack-config/style-loader.js | 7 +------ .../postcss-options.js => template/postcss.config.js} | 7 ++----- 2 files changed, 3 insertions(+), 11 deletions(-) rename packages/react-scripts/{config/custom-react-scripts/options/postcss-options.js => template/postcss.config.js} (62%) diff --git a/packages/react-scripts/config/custom-react-scripts/webpack-config/style-loader.js b/packages/react-scripts/config/custom-react-scripts/webpack-config/style-loader.js index 7530da206ec..c1ae8f455dd 100644 --- a/packages/react-scripts/config/custom-react-scripts/webpack-config/style-loader.js +++ b/packages/react-scripts/config/custom-react-scripts/webpack-config/style-loader.js @@ -1,4 +1,3 @@ -const postCssOptions = require('../options/postcss-options'); const extractTextPluginOptions = require('../options/extract-text-plugin-options'); const ExtractTextPlugin = require('extract-text-webpack-plugin'); const shouldUseSourceMap = process.env.GENERATE_SOURCEMAP !== 'false'; @@ -28,11 +27,7 @@ module.exports = (loader, test, exclude, modules) => isDev => { }, { loader: require.resolve('postcss-loader'), - options: Object.assign( - {}, - { sourceMap: shouldUseSourceMap }, - postCssOptions - ), + options: Object.assign({}, { sourceMap: shouldUseSourceMap }), }, ]); diff --git a/packages/react-scripts/config/custom-react-scripts/options/postcss-options.js b/packages/react-scripts/template/postcss.config.js similarity index 62% rename from packages/react-scripts/config/custom-react-scripts/options/postcss-options.js rename to packages/react-scripts/template/postcss.config.js index 07c1a1278e1..eb167d9b8b2 100644 --- a/packages/react-scripts/config/custom-react-scripts/options/postcss-options.js +++ b/packages/react-scripts/template/postcss.config.js @@ -1,10 +1,7 @@ -const autoprefixer = require('autoprefixer'); - module.exports = { - ident: 'postcss', - plugins: () => [ + plugins: [ require('postcss-flexbugs-fixes'), - autoprefixer({ + require('autoprefixer')({ browsers: ['>1%', 'last 4 versions', 'Firefox ESR', 'not ie < 9'], flexbox: 'no-2009', }),