Uh oh!
There was an error while loading. Please reload this page.
Load favicon through html-loader. - #428
Conversation
| <head> | ||
| <meta charset="utf-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
| <link rel="shortcut icon" href="${require('./src/favicon.ico')}"> |
There was a problem hiding this comment.
There's a way to make html-loader work just on <link href="./src/favicon.js"> but I don't know how.
There was a problem hiding this comment.
Are you sure? require("./src/favicon.js") seems less magical and also consistent with other webpack-isms used (require("./index.css")).
There was a problem hiding this comment.
It's just a weird thing to explain. Imports are natural in JS but odd in HTML. Also since we use ES6 some people won't even know what require is.
andreypopp
commented
Aug 12, 2016
Also, I don't have any idea how all of this works... Seems like html-webpack-plugin runs html through |
| test: /\.html/, | ||
| loader: 'html', | ||
| query: { | ||
| attrs: ['link:href'], |
There was a problem hiding this comment.
Could be extended with other tag:attribute combinations.
There was a problem hiding this comment.
Oooh nice. Can you think up any other common combinations?
There was a problem hiding this comment.
I wouldn't bother adding more at the moment but rather serve on per-request basis.
There was a problem hiding this comment.
I think img:src is out of scope.
gaearon
commented
Aug 12, 2016
👍 Nice job |
just-boris
commented
Aug 14, 2016
As you already have @andreypopp Why you didn't do that? |
gaearon
commented
Aug 14, 2016
@just-boris This was exactly how it worked before. The intention here is not to solve the favico case but solve the generic problem of “how do I reference image (or other) files from |
* Disable contentBase in development * Document #428
* Load favicon through html-loader. Fixesreact#291. * Add test for *.ico in e2e test suite * Configure html-loader to process <link href="..."> * Address feedback on html-loader inclusion. * Place favicon.ico at the root of the build dir * Make comment style consistent between prod and dev webpack configs * Fix html-loader config in dev mode
* Disable contentBase in development * Document react#428
* Load favicon through html-loader. Fixesreact#291. * Add test for *.ico in e2e test suite * Configure html-loader to process <link href="..."> * Address feedback on html-loader inclusion. * Place favicon.ico at the root of the build dir * Make comment style consistent between prod and dev webpack configs * Fix html-loader config in dev mode
* Disable contentBase in development * Document react#428
Migration Instructions
Now
favicon.icois not treated specially anymore.If you use it, move it to
srcand add the following line to<head>in your HTML:Use html-loader to load favicon.
Test plan:
Fixes#291.