Skip to content

Commit 15feb02

Browse files
bogdansoaregaearon
authored andcommitted
Use file-loader for svgs (#1180)
1 parent d8dfdb0 commit 15feb02

File tree

3 files changed

+23
-2
lines changed

3 files changed

+23
-2
lines changed

packages/react-scripts/config/webpack.config.dev.js

+10-1
Original file line numberDiff line numberDiff line change
@@ -131,7 +131,8 @@ module.exports = {
131131
/\.html$/,
132132
/\.(js|jsx)$/,
133133
/\.css$/,
134-
/\.json$/
134+
/\.json$/,
135+
/\.svg$/
135136
],
136137
loader: 'url',
137138
query: {
@@ -169,6 +170,14 @@ module.exports = {
169170
{
170171
test: /\.json$/,
171172
loader: 'json'
173+
},
174+
// "file" loader for svg
175+
{
176+
test: /\.svg$/,
177+
loader: 'file',
178+
query: {
179+
name: 'static/media/[name].[hash:8].[ext]'
180+
}
172181
}
173182
]
174183
},

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: {
@@ -180,6 +181,14 @@ module.exports = {
180181
{
181182
test: /\.json$/,
182183
loader: 'json'
184+
},
185+
// "file" loader for svg
186+
{
187+
test: /\.svg$/,
188+
loader: 'file',
189+
query: {
190+
name: 'static/media/[name].[hash:8].[ext]'
191+
}
183192
}
184193
]
185194
},

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)