Skip to content

Commit b0f3db8

Browse files
committed
fix: js.chunkFilename should default to js.filename when js.filename is specified as a string, #164
1 parent 132ac85 commit b0f3db8

File tree

155 files changed

+427
-80
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

155 files changed

+427
-80
lines changed

CHANGELOG.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,21 @@
11
# Changelog
22

3-
## Not Released
3+
## 4.19.1
44

5-
- fix: `js.chunkFilename` should default to `js.filename` when possible.
5+
- fix: `js.chunkFilename` should default to `js.filename` when `js.filename` is specified as a string, #164
66

77
## 4.19.0
88

9-
### 🔥 BREAKING CHANGES by inlining SVG only
9+
### 🔥 CHANGES by inlining SVG only
1010

1111
- Inline `<img src="icon.svg">`:
1212
- OLD: replaces `<img>` with `<svg>` tag
1313
- NEW: inline SVG as base64-encoded data URL. Use new `svg.inline.embed = true` option to keep old behavior.
1414
- Encoding of data URL:
1515
- OLD: defaults, escaped URL (`#%` chars only), e.g. `data:image/svg+xml,<svg>...</svg>`
1616
- NEW:
17-
- defaults, base64 encoded, e.g. `data:image/svg+xml;base64,iVBO`
18-
- full escaped URL, e.g. `data:image/svg+xml,%3Csvg%20` regards `generator.dataUrl.encoding` option.
17+
- defaults, base64 encoded, e.g. `data:image/svg+xml;base64,iVBO...`
18+
- full escaped URL, e.g. `data:image/svg+xml,%3Csvg%20...` regards `generator.dataUrl.encoding` option.
1919

2020
### ✨ Features
2121

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "html-bundler-webpack-plugin",
3-
"version": "4.19.0",
3+
"version": "4.19.1",
44
"description": "Generates complete single-page or multi-page website from source assets. Build-in support for Markdown, Eta, EJS, Handlebars, Nunjucks, Pug. Alternative to html-webpack-plugin.",
55
"keywords": [
66
"html",

src/Plugin/Option.js

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -236,19 +236,12 @@ class Option {
236236

237237
if (js.chunkFilename) {
238238
options.output.chunkFilename = js.chunkFilename;
239-
} else if (js.filename) {
240-
/**
241-
* When js.filename exists, it is possible that options.output.filename is overridden
242-
*
243-
* But, that overide is happened after webpack populated the options.output.filename, thus
244-
* webpack doesn't see the js.filename, and will populate the options.output.chunkFilename
245-
* with its default value "[id].js". This is not ideal since js.filename should be preferred
246-
* over "[id].js".
247-
*
248-
* So we manually override the options.output.chunkFilename with js.filename
249-
*/
239+
} else if (js.filename && typeof js.filename === 'string') {
240+
// Webpack behaviour: `chunkFilename` should default to `filename` when `filename` is specified as a string
250241
options.output.chunkFilename = js.filename;
251-
} else { // default to options.output.chunkFilename, which webpack always populate with no-exist-default "[id].js"
242+
js.chunkFilename = js.filename;
243+
} else {
244+
// defaults is '[id].js'
252245
js.chunkFilename = options.output.chunkFilename;
253246
}
254247

test/cases/integrity-dynamic-chunks-comments-false/expected/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<title>Test</title>
55
<!-- load source script -->
6-
<script src="main.f88dc101.js" defer="defer" integrity="sha384-dwDWeKC5w+2dA4jDjLsqO/7Dn420Pwm7GLtJo9tPG2/ovT/+9Tzhh5ExjV99ZeQH" crossorigin="anonymous"></script>
6+
<script src="main.6b4b608d.js" defer="defer" integrity="sha384-G822FzPy501sM0JmLPB3hYC1X51iqqHbqfhjeiBvK5jR6cARK6xXiDEDeOEUEocf" crossorigin="anonymous"></script>
77
</head>
88
<body>
99
<h1>Hello World!</h1>

test/cases/integrity-dynamic-chunks-comments-false/expected/main.6b4b608d.js

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cases/integrity-dynamic-chunks-comments-false/expected/main.f88dc101.js

Lines changed: 0 additions & 1 deletion
This file was deleted.

test/cases/integrity-dynamic-chunks-comments-true/expected/473.js renamed to test/cases/integrity-dynamic-chunks-comments-true/expected/473.dbcd5ffb.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/cases/integrity-dynamic-chunks-comments-true/expected/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<head>
44
<title>Test</title>
55
<!-- load source script -->
6-
<script src="main.17a7517f.js" defer="defer" integrity="sha384-1TjeYBCjzejAnrKFKCO4AsQC7kKYlE5baoxjgSDjXOJxr/J6qRtnBrRXLSdOwyWT" crossorigin="anonymous"></script>
6+
<script src="main.b268190d.js" defer="defer" integrity="sha384-Y4rG93SSBHOnAuD10lCpfSyMlTz1/iCB/p0ZdVsu1jw6amHYAJYcCWT3CdYv7xMP" crossorigin="anonymous"></script>
77
</head>
88
<body>
99
<h1>Hello World!</h1>

0 commit comments

Comments
 (0)