Skip to content

Commit

Permalink
Use file-loader for svgs (facebook#1180)
Browse files Browse the repository at this point in the history
  • Loading branch information
bogdansoare authored and randycoulman committed May 8, 2017
1 parent 5a2c4a9 commit 6930cae
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 2 deletions.
11 changes: 10 additions & 1 deletion packages/react-scripts/config/webpack.config.dev.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,8 @@ module.exports = function(publicPath) {
/\.html$/,
/\.(js|jsx)$/,
/\.css$/,
/\.json$/
/\.json$/,
/\.svg$/
],
loader: 'url',
query: {
Expand Down Expand Up @@ -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]'
}
}
]
},
Expand Down
11 changes: 10 additions & 1 deletion packages/react-scripts/config/webpack.config.prod.js
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,8 @@ module.exports = {
/\.html$/,
/\.(js|jsx)$/,
/\.css$/,
/\.json$/
/\.json$/,
/\.svg$/
],
loader: 'url',
query: {
Expand Down Expand Up @@ -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]'
}
}
]
},
Expand Down
3 changes: 3 additions & 0 deletions tasks/e2e.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down

0 comments on commit 6930cae

Please sign in to comment.