From e1a374b914d0ebb784244237e5393a5b82f260cb Mon Sep 17 00:00:00 2001 From: Jared Palmer Date: Wed, 7 Jun 2017 13:02:47 -0400 Subject: [PATCH] CRA CSS-parity: postcss-flexbox-bugs --- packages/razzle/config/create-config.js | 48 ++++++++++++++++++------- packages/razzle/package.json | 1 + packages/razzle/yarn.lock | 6 ++++ 3 files changed, 42 insertions(+), 13 deletions(-) diff --git a/packages/razzle/config/create-config.js b/packages/razzle/config/create-config.js index 110ef7479..abb3a59d1 100644 --- a/packages/razzle/config/create-config.js +++ b/packages/razzle/config/create-config.js @@ -78,20 +78,38 @@ module.exports = ( // Transform ES6 with Babel { test: /\.js?$/, - loader: 'babel-loader', + loader: require.resolve('babel-loader'), include: [paths.appSrc], options: mainBabelOptions, }, - // Handle files with url-loader. It will inline files into a data-uri - // if they are smaller than 20000 bytes. { - test: /\.(jpg|jpeg|png|gif|eot|svg|ttf|woff|woff2)$/, - loader: 'url-loader', - exclude: [paths.appNodeModules, paths.appBuild], + exclude: [ + /\.html$/, + /\.(js|jsx)$/, + /\.css$/, + /\.json$/, + /\.bmp$/, + /\.gif$/, + /\.jpe?g$/, + /\.png$/, + ], + loader: require.resolve('file-loader'), options: { - limit: 20000, + name: 'static/media/[name].[hash:8].[ext]', }, }, + // "url" loader works like "file" loader except that it embeds assets + // smaller than specified limit in bytes as data URLs to avoid requests. + // A missing `test` is equivalent to a match. + { + test: [/\.bmp$/, /\.gif$/, /\.jpe?g$/, /\.png$/], + loader: require.resolve('url-loader'), + options: { + limit: 10000, + name: 'static/media/[name].[hash:8].[ext]', + }, + }, + // "postcss" loader applies autoprefixer to our CSS. // "css" loader resolves paths in CSS and adds assets as dependencies. // "style" loader turns CSS into JS modules that inject