jantimon/html-webpack-plugin

Url of chunk filenames are not `urlencoded`

zbigg opened this issue · 2 comments

zbigg commented

Expected behaviour

URI of files in emitted HTML should be "urlencoded".

Current behaviour

URI of files in emitted to HTML as is, with no visible encoding.

Config

const HtmlWebpackPlugin = require("html-webpack-plugin");

module.exports = {
    context: __dirname,
    entry: {
        "app+foo": "./index.js",
    },
    plugins: [
        new HtmlWebpackPlugin()
    ]
}

Expected that emitted <script> tag contains src="app%2bfoo.js".
But, we see src="app+foo.js", which points at "app foo.js" (space inside).

Relevant Links

Environment

html-webpack-plugin@3.2.0 
webpack@4.38.0 

Hey @zbigg thanks for your feedback!

This is the part where the asset path is build up and probably the place where we could also encode:

const entryPointPublicPath = publicPath + chunkFile;

We should also try how this behaves for output configurations which contain a slash:

 output: {
       filename: 'folder/prefix+[name].bundle.js'
},

Do you have time to prepare a pull request?

zbigg commented

@jantimon With such good hint, it should be easy to add. I'll look into making PR for this.