From 6930cae23fc8b2cc64e5082f7c310f2fc2331320 Mon Sep 17 00:00:00 2001 From: Bogdan Soare Date: Tue, 6 Dec 2016 18:07:50 +0200 Subject: [PATCH] Use file-loader for svgs (#1180) --- packages/react-scripts/config/webpack.config.dev.js | 11 ++++++++++- packages/react-scripts/config/webpack.config.prod.js | 11 ++++++++++- tasks/e2e.sh | 3 +++ 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index 529ccbc313f..236208c0aa9 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -145,7 +145,8 @@ module.exports = function(publicPath) { /\.html$/, /\.(js|jsx)$/, /\.css$/, - /\.json$/ + /\.json$/, + /\.svg$/ ], loader: 'url', query: { @@ -196,6 +197,14 @@ module.exports = function(publicPath) { { test: /\.json$/, loader: 'json' + }, + // "file" loader for svg + { + test: /\.svg$/, + loader: 'file', + query: { + name: 'static/media/[name].[hash:8].[ext]' + } } ] }, diff --git a/packages/react-scripts/config/webpack.config.prod.js b/packages/react-scripts/config/webpack.config.prod.js index e9ba473a4e2..37e9f3c5cb0 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -138,7 +138,8 @@ module.exports = { /\.html$/, /\.(js|jsx)$/, /\.css$/, - /\.json$/ + /\.json$/, + /\.svg$/ ], loader: 'url', query: { @@ -198,6 +199,14 @@ module.exports = { { test: /\.json$/, loader: 'json' + }, + // "file" loader for svg + { + test: /\.svg$/, + loader: 'file', + query: { + name: 'static/media/[name].[hash:8].[ext]' + } } ] }, diff --git a/tasks/e2e.sh b/tasks/e2e.sh index 58e6ad53ee8..ce7b50f35b5 100755 --- a/tasks/e2e.sh +++ b/tasks/e2e.sh @@ -76,6 +76,7 @@ npm run build test -e build/*.html test -e build/static/js/*.js test -e build/static/css/*.css +test -e build/static/media/*.svg test -e build/favicon.ico # Run tests with CI flag @@ -140,6 +141,7 @@ npm run build test -e build/*.html test -e build/static/js/*.js test -e build/static/css/*.css +test -e build/static/media/*.svg test -e build/favicon.ico # Run tests with CI flag @@ -169,6 +171,7 @@ npm run build test -e build/*.html test -e build/static/js/*.js test -e build/static/css/*.css +test -e build/static/media/*.svg test -e build/favicon.ico # Run tests, overring the watch option to disable it.