From 8af43b854e5a3949bf4e3de883a39f8d30942d53 Mon Sep 17 00:00:00 2001 From: Ro Savage Date: Sat, 20 May 2017 22:26:57 +1200 Subject: [PATCH 1/5] Add css modules with [name].modules.css file convention --- .../config/webpack.config.dev.js | 48 +++++++++++++---- .../config/webpack.config.prod.js | 54 +++++++++++++++---- .../features/webpack/CssModulesInclusion.js | 15 ++++++ .../webpack/CssModulesInclusion.test.js | 19 +++++++ .../features/webpack/assets/style.module.css | 4 ++ packages/react-scripts/template/README.md | 44 +++++++++++++++ 6 files changed, 164 insertions(+), 20 deletions(-) create mode 100644 packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssModulesInclusion.js create mode 100644 packages/react-scripts/fixtures/kitchensink/src/features/webpack/CssModulesInclusion.test.js create mode 100644 packages/react-scripts/fixtures/kitchensink/src/features/webpack/assets/style.module.css diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index c975a58c790..94a551cd801 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -30,6 +30,20 @@ const publicUrl = ''; // Get environment variables to inject into our app. const env = getClientEnvironment(publicUrl); +// Options for PostCSS as we reference these options twice +// Adds vendor prefixing to support IE9 and above +const postCSSLoaderOptions = { + // Necessary for external CSS imports to work + // https://github.com/facebookincubator/create-react-app/issues/2677 + ident: 'postcss', + plugins: () => [ + require('postcss-flexbugs-fixes'), + autoprefixer({ + flexbox: 'no-2009', + }), + ], +}; + // This is the development configuration. // It is focused on developer experience and fast rebuilds. // The production configuration is different and lives in a separate file. @@ -209,8 +223,10 @@ module.exports = { // "style" loader turns CSS into JS modules that inject