diff --git a/packages/react-scripts/config/webpack.config.dev.js b/packages/react-scripts/config/webpack.config.dev.js index e002befc1e..137529b79b 100644 --- a/packages/react-scripts/config/webpack.config.dev.js +++ b/packages/react-scripts/config/webpack.config.dev.js @@ -122,6 +122,32 @@ module.exports = function(publicPath) { } ], loaders: [ + // Default loader: load all assets that are not handled + // by other loaders with the url loader. + // Note: This list needs to be updated with every change of extensions + // the other loaders match. + // E.g., when adding a loader for a new supported file extension, + // we need to add the supported extension to this loader too. + // Add one new line in `exclude` for each loader. + // + // "file" loader makes sure those assets get served by WebpackDevServer. + // When you `import` an asset, you get its (virtual) filename. + // In production, they would get copied to the `build` folder. + // "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. + { + exclude: [ + /\.(js|jsx)$/, + /\.css$/, + /\.json$/ + ], + loader: 'url', + query: { + limit: 10000, + name: 'static/media/[name].[hash:8].[ext]' + } + }, // Process JS with Babel. { test: /\.(js|jsx)$/, @@ -165,26 +191,6 @@ module.exports = function(publicPath) { { test: /\.json$/, loader: 'json' - }, - // "file" loader makes sure those assets get served by WebpackDevServer. - // When you `import` an asset, you get its (virtual) filename. - // In production, they would get copied to the `build` folder. - { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, - loader: 'file', - query: { - name: 'static/media/[name].[hash:8].[ext]' - } - }, - // "url" loader works just like "file" loader but it also embeds - // assets smaller than specified size as data URLs to avoid requests. - { - test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, - loader: 'url', - query: { - limit: 10000, - 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 bc091df473..6ca87963a6 100644 --- a/packages/react-scripts/config/webpack.config.prod.js +++ b/packages/react-scripts/config/webpack.config.prod.js @@ -116,6 +116,32 @@ module.exports = { } ], loaders: [ + // Default loader: load all assets that are not handled + // by other loaders with the url loader. + // Note: This list needs to be updated with every change of extensions + // the other loaders match. + // E.g., when adding a loader for a new supported file extension, + // we need to add the supported extension to this loader too. + // Add one new line in `exclude` for each loader. + // + // "file" loader makes sure those assets get served by WebpackDevServer. + // When you `import` an asset, you get its (virtual) filename. + // In production, they would get copied to the `build` folder. + // "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. + { + exclude: [ + /\.(js|jsx)$/, + /\.css$/, + /\.json$/ + ], + loader: 'url', + query: { + limit: 10000, + name: 'static/media/[name].[hash:8].[ext]' + } + }, // Process JS with Babel. { test: /\.(js|jsx)$/, @@ -168,25 +194,6 @@ module.exports = { { test: /\.json$/, loader: 'json' - }, - // "file" loader makes sure those assets end up in the `build` folder. - // When you `import` an asset, you get its filename. - { - test: /\.(ico|jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2)(\?.*)?$/, - loader: 'file', - query: { - name: 'static/media/[name].[hash:8].[ext]' - } - }, - // "url" loader works just like "file" loader but it also embeds - // assets smaller than specified size as data URLs to avoid requests. - { - test: /\.(mp4|webm|wav|mp3|m4a|aac|oga)(\?.*)?$/, - loader: 'url', - query: { - limit: 10000, - name: 'static/media/[name].[hash:8].[ext]' - } } ] }, diff --git a/tasks/e2e.sh b/tasks/e2e.sh index 094fba9e22..9066af93f2 100755 --- a/tasks/e2e.sh +++ b/tasks/e2e.sh @@ -75,7 +75,6 @@ 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 @@ -133,7 +132,6 @@ 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 @@ -163,7 +161,6 @@ 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.