jantimon / jantimon/html-webpack-plugin

Support opt-out the automatically added trailing slash for publicPath

Open
#1,701 5 comments 1 reaction 0 assignees View on GitHub
wontfix
Dominant language
JavaScript
Stars
10.7k
Forks
1.3k
Avg merge
1m
Merged PRs (30d)
1

Description

**Is your feature request related to a problem? Please describe.**
I want to set my publicPath to something like ``, which is a [nginx ssi expression](https://nginx.org/en/docs/http/ngx_http_ssi_module.html#commands).

I have a config like:

```js
new HtmlWebpackPlugin({
filename: "index.html",
publicPath: "",
}),
```

I want the output html to be like:

```html

```

But it automatically added a trailing slash for the publicPath, it output:

```html

^
```

**Describe the solution you'd like**

It would be nice to have an option to opt-out the automatically added trailing slash for `publicPath`.

Something like:

```js
new HtmlWebpackPlugin({
filename: "index.html",
publicPath: "",
publicPathTrailingSlash: false,
}),
```

P.S. I am using webpack v4 along with html-webpack-plugin v4, so supports it in v4 would be nice, thank you.

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by tracing how html-webpack-plugin combines publicPath with generated bundle URLs, using the configuration and HTML output shown in the issue. Reproduce the nginx SSI case with webpack 4 and html-webpack-plugin 4, then verify that an opt-out produces main.js without an inserted slash.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, webpack
Domain
build-system
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Clearly specified
Newbie friendliness
52/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.