parent
b65c39c2f1
commit
713643f84f
8
index.js
8
index.js
|
|
@ -75,11 +75,11 @@ HtmlWebpackPlugin.prototype.apply = function (compiler) {
|
|||
if (self.options.favicon) {
|
||||
return self.addFileToAssets(self.options.favicon, compilation)
|
||||
.then(function (faviconBasename) {
|
||||
if (compilation.options.output.publicPath) {
|
||||
assets.favicon = compilation.options.output.publicPath + faviconBasename;
|
||||
} else {
|
||||
assets.favicon = faviconBasename;
|
||||
var publicPath = compilation.options.output.publicPath || '';
|
||||
if (publicPath && publicPath.substr(-1) !== '/') {
|
||||
publicPath += '/';
|
||||
}
|
||||
assets.favicon = publicPath + faviconBasename;
|
||||
});
|
||||
}
|
||||
})
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "html-webpack-plugin",
|
||||
"version": "2.8.2",
|
||||
"version": "2.9.0",
|
||||
"description": "Simplifies creation of HTML files to serve your webpack bundles",
|
||||
"main": "index.js",
|
||||
"files": [
|
||||
|
|
|
|||
|
|
@ -770,7 +770,7 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}, [/<link rel="shortcut icon" href="[^"]+\.ico">/], null, done);
|
||||
});
|
||||
|
||||
it('adds a favicon with publicPath set', function (done) {
|
||||
it('adds a favicon with publicPath set to /some/', function (done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
output: {
|
||||
|
|
@ -786,6 +786,22 @@ describe('HtmlWebpackPlugin', function () {
|
|||
}, [/<link rel="shortcut icon" href="\/some\/+[^"]+\.ico">/], null, done);
|
||||
});
|
||||
|
||||
it('adds a favicon with publicPath set to /some', function (done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
output: {
|
||||
path: OUTPUT_DIR,
|
||||
publicPath: '/some',
|
||||
filename: 'index_bundle.js'
|
||||
},
|
||||
plugins: [
|
||||
new HtmlWebpackPlugin({
|
||||
favicon: path.join(__dirname, 'fixtures/favicon.ico')
|
||||
})
|
||||
]
|
||||
}, [/<link rel="shortcut icon" href="\/some\/+[^"]+\.ico">/], null, done);
|
||||
});
|
||||
|
||||
it('adds a favicon with inject enabled', function (done) {
|
||||
testHtmlPlugin({
|
||||
entry: path.join(__dirname, 'fixtures/index.js'),
|
||||
|
|
|
|||
Loading…
Reference in New Issue