Skip to content

Commit 6930cae

Browse files
bogdansoarerandycoulman
authored andcommitted
Use file-loader for svgs (facebook#1180)
1 parent 5a2c4a9 commit 6930cae

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

Diff for: packages/react-scripts/config/webpack.config.dev.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -145,7 +145,8 @@ module.exports = function(publicPath) {
145145
/\.html$/,
146146
/\.(js|jsx)$/,
147147
/\.css$/,
148-
/\.json$/
148+
/\.json$/,
149+
/\.svg$/
149150
],
150151
loader: 'url',
151152
query: {
@@ -196,6 +197,14 @@ module.exports = function(publicPath) {
196197
{
197198
test: /\.json$/,
198199
loader: 'json'
200+
},
201+
// "file" loader for svg
202+
{
203+
test: /\.svg$/,
204+
loader: 'file',
205+
query: {
206+
name: 'static/media/[name].[hash:8].[ext]'
207+
}
199208
}
200209
]
201210
},

Diff for: packages/react-scripts/config/webpack.config.prod.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -138,7 +138,8 @@ module.exports = {
138138
/\.html$/,
139139
/\.(js|jsx)$/,
140140
/\.css$/,
141-
/\.json$/
141+
/\.json$/,
142+
/\.svg$/
142143
],
143144
loader: 'url',
144145
query: {
@@ -198,6 +199,14 @@ module.exports = {
198199
{
199200
test: /\.json$/,
200201
loader: 'json'
202+
},
203+
// "file" loader for svg
204+
{
205+
test: /\.svg$/,
206+
loader: 'file',
207+
query: {
208+
name: 'static/media/[name].[hash:8].[ext]'
209+
}
201210
}
202211
]
203212
},

Diff for: tasks/e2e.sh

+3
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ npm run build
7676
test -e build/*.html
7777
test -e build/static/js/*.js
7878
test -e build/static/css/*.css
79+
test -e build/static/media/*.svg
7980
test -e build/favicon.ico
8081

8182
# Run tests with CI flag
@@ -140,6 +141,7 @@ npm run build
140141
test -e build/*.html
141142
test -e build/static/js/*.js
142143
test -e build/static/css/*.css
144+
test -e build/static/media/*.svg
143145
test -e build/favicon.ico
144146

145147
# Run tests with CI flag
@@ -169,6 +171,7 @@ npm run build
169171
test -e build/*.html
170172
test -e build/static/js/*.js
171173
test -e build/static/css/*.css
174+
test -e build/static/media/*.svg
172175
test -e build/favicon.ico
173176

174177
# Run tests, overring the watch option to disable it.

0 commit comments

Comments
 (0)