jharris4 / html-webpack-tags-plugin

lets you define html tags to inject with html-webpack-plugin
MIT License
256 stars 31 forks source link

Forward slash removed in URL protocol for public path output, 'http:// to http:/' #47

Closed jayryemure closed 5 years ago

jayryemure commented 5 years ago

One of the forward slashes in the URL protocol seems to be removed from the outputted public path. http://[foo] to http:/[foo]

Ex:

    plugins: [,
        new HtmlWebpackPlugin({ template: 'index.html' }),
        new HtmlWebpackTagsPlugin({
            publicPath: 'https://www.foo.com',
            tags: [{ path: 'content/css', glob: '*.css', globPath: buildDir + '/content/css'}]
        })
    ]

Actual Result:

<link href="https:/www.foo.com/content/css/main.min.2976747713ab1fa371cde6441e3cfdef.css" rel="stylesheet"></head>

(https:/)

Expected Result:

<link href="https://www.foo.com/content/css/main.min.2976747713ab1fa371cde6441e3cfdef.css" rel="stylesheet"></head>

(https://)

Env:

webpack@4.33.O
html-webpack-plugin@3.2.O
html-webpack-tags-plugin@2.0.12

Microsoft Windows 10 Pro 10.0.15063 Build 15063
jharris4 commented 5 years ago

Interesting, I hadn't tried using a full domain in the publicPath before. Is there any reason you're configuring it that way instead of just using / ?

jharris4 commented 5 years ago

I just added a unit test for this case, and it is failing even on Mac. I'll look and see if I can fix it and get back to you.

jharris4 commented 5 years ago

Thanks for bringing this to my attention! I've fixed the bug and released the fix in version 1.0.13.

Please confirm if it's now fixed for you and we can close this issue.

jayryemure commented 5 years ago

@jharris4 I've confirmed that it works for me on 1.0.13, thanks for the fix.