-
-
Notifications
You must be signed in to change notification settings - Fork 26.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Load favicon through html-loader. #428
Changes from 3 commits
9c21c40
50fce72
edef7d3
22b175d
f35f725
58232c5
38f668b
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -126,7 +126,7 @@ module.exports = { | |
// When you `import` an asset, you get its (virtual) filename. | ||
// In production, they would get copied to the `build` folder. | ||
{ | ||
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/, | ||
test: /\.(ico|jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/, | ||
include: [paths.appSrc, paths.appNodeModules], | ||
loader: 'file', | ||
query: { | ||
|
@@ -143,6 +143,15 @@ module.exports = { | |
limit: 10000, | ||
name: 'static/media/[name].[ext]' | ||
} | ||
}, | ||
// "html" loader is used to process template page (index.html) to resolve | ||
// resources linked with <link href="./relative/path"> HTML tags. | ||
{ | ||
test: /\.html/, | ||
loader: 'html', | ||
query: { | ||
attrs: ['link:href'], | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Could be extended with other There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Oooh nice. Can you think up any other common combinations? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I wouldn't bother adding more at the moment but rather serve on per-request basis. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think |
||
} | ||
} | ||
] | ||
}, | ||
|
@@ -169,7 +178,6 @@ module.exports = { | |
new HtmlWebpackPlugin({ | ||
inject: true, | ||
template: paths.appHtml, | ||
favicon: paths.appFavicon, | ||
}), | ||
// Makes some environment variables available to the JS code, for example: | ||
// if (process.env.NODE_ENV === 'development') { ... }. See `env.js`. | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -136,7 +136,7 @@ module.exports = { | |
{ | ||
// "file" loader makes sure those assets end up in the `build` folder. | ||
// When you `import` an asset, you get its filename. | ||
test: /\.(jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/, | ||
test: /\.(ico|jpg|png|gif|eot|svg|ttf|woff|woff2)(\?.*)?$/, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Ideally We could declare a loader entry specifically for it with hardcoded There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
It does! |
||
include: [paths.appSrc, paths.appNodeModules], | ||
loader: 'file', | ||
query: { | ||
|
@@ -153,6 +153,15 @@ module.exports = { | |
limit: 10000, | ||
name: 'static/media/[name].[hash:8].[ext]' | ||
} | ||
}, | ||
// "html" loader is used to process template page (index.html) to resolve | ||
// resources linked with <link href="./relative/path"> HTML tags. | ||
{ | ||
test: /\.html/, | ||
loader: 'html', | ||
query: { | ||
attrs: ['link:href'], | ||
} | ||
} | ||
] | ||
}, | ||
|
@@ -181,7 +190,6 @@ module.exports = { | |
new HtmlWebpackPlugin({ | ||
inject: true, | ||
template: paths.appHtml, | ||
favicon: paths.appFavicon, | ||
minify: { | ||
removeComments: true, | ||
collapseWhitespace: true, | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -61,6 +61,7 @@ | |
"filesize": "3.3.0", | ||
"fs-extra": "0.30.0", | ||
"gzip-size": "3.0.0", | ||
"html-loader": "^0.4.3", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let’s drop caret here |
||
"html-webpack-plugin": "2.22.0", | ||
"http-proxy-middleware": "0.17.0", | ||
"jest": "14.1.0", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should end with
$
?