Skip to content

Commit 9c21c40

Browse files
committed
Load favicon through html-loader.
Fixes facebook#291.
1 parent 25a0b66 commit 9c21c40

File tree

5 files changed

+3
-7
lines changed

5 files changed

+3
-7
lines changed

Diff for: config/paths.js

-3
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@ if (isInCreateReactAppSource) {
3636
module.exports = {
3737
appBuild: resolveOwn('../build'),
3838
appHtml: resolveOwn('../template/index.html'),
39-
appFavicon: resolveOwn('../template/favicon.ico'),
4039
appPackageJson: resolveOwn('../package.json'),
4140
appSrc: resolveOwn('../template/src'),
4241
appNodeModules: resolveOwn('../node_modules'),
@@ -47,7 +46,6 @@ if (isInCreateReactAppSource) {
4746
module.exports = {
4847
appBuild: resolveApp('build'),
4948
appHtml: resolveApp('index.html'),
50-
appFavicon: resolveApp('favicon.ico'),
5149
appPackageJson: resolveApp('package.json'),
5250
appSrc: resolveApp('src'),
5351
appNodeModules: resolveApp('node_modules'),
@@ -59,7 +57,6 @@ if (isInCreateReactAppSource) {
5957
module.exports = {
6058
appBuild: resolveApp('build'),
6159
appHtml: resolveApp('index.html'),
62-
appFavicon: resolveApp('favicon.ico'),
6360
appPackageJson: resolveApp('package.json'),
6461
appSrc: resolveApp('src'),
6562
appNodeModules: resolveApp('node_modules'),

Diff for: config/webpack.config.dev.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ module.exports = {
126126
// When you `import` an asset, you get its (virtual) filename.
127127
// In production, they would get copied to the `build` folder.
128128
{
129-
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
129+
test: /\.(ico|jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
130130
include: [paths.appSrc, paths.appNodeModules],
131131
loader: 'file',
132132
query: {
@@ -169,7 +169,6 @@ module.exports = {
169169
new HtmlWebpackPlugin({
170170
inject: true,
171171
template: paths.appHtml,
172-
favicon: paths.appFavicon,
173172
}),
174173
// Makes some environment variables available to the JS code, for example:
175174
// if (process.env.NODE_ENV === 'development') { ... }. See `env.js`.

Diff for: config/webpack.config.prod.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ module.exports = {
136136
{
137137
// "file" loader makes sure those assets end up in the `build` folder.
138138
// When you `import` an asset, you get its filename.
139-
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
139+
test: /\.(ico|jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/,
140140
include: [paths.appSrc, paths.appNodeModules],
141141
loader: 'file',
142142
query: {
@@ -181,7 +181,6 @@ module.exports = {
181181
new HtmlWebpackPlugin({
182182
inject: true,
183183
template: paths.appHtml,
184-
favicon: paths.appFavicon,
185184
minify: {
186185
removeComments: true,
187186
collapseWhitespace: true,

Diff for: template/index.html

+1
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
<head>
44
<meta charset="utf-8">
55
<meta name="viewport" content="width=device-width, initial-scale=1">
6+
<link rel="shortcut icon" href="${require('./src/favicon.ico')}">
67
<title>React App</title>
78
</head>
89
<body>
File renamed without changes.

0 commit comments

Comments
 (0)