Compare commits

...

6 Commits

Author SHA1 Message Date
Ryuya 77df87468b
Merge 44db038779 into e1afcd4cc2 2025-10-03 20:10:22 +05:30
Alexander Akait e1afcd4cc2
test: stability and avoid extra output (#19974)
Github Actions / lint (push) Has been cancelled Details
Github Actions / validate-legacy-node (push) Has been cancelled Details
Github Actions / benchmark (1/4) (push) Has been cancelled Details
Github Actions / benchmark (2/4) (push) Has been cancelled Details
Github Actions / benchmark (3/4) (push) Has been cancelled Details
Github Actions / benchmark (4/4) (push) Has been cancelled Details
Github Actions / basic (push) Has been cancelled Details
Github Actions / unit (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (10.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (12.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (14.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (16.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (18.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (20.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (22.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, macos-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, ubuntu-latest, b) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, a) (push) Has been cancelled Details
Github Actions / integration (24.x, windows-latest, b) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, a, 1) (push) Has been cancelled Details
Github Actions / integration (lts/*, ubuntu-latest, b, 1) (push) Has been cancelled Details
2025-10-02 21:55:56 +03:00
Alexander Akait d45073a2b3
fix: dynamic import support in workers using browserslist (#19972) 2025-10-02 19:19:35 +03:00
Ryuya 44db038779 feat: add general discussion template 2025-08-30 10:34:46 +09:00
Ryuya b8aaeac1de chore: remove validation checkboxes 2025-08-28 08:34:08 +09:00
Ryuya 8823af17f5 feat: improve issue templates and add discussion templates 2025-07-12 15:32:49 -07:00
19 changed files with 562 additions and 133 deletions

72
.github/DISCUSSION_TEMPLATE/ideas.yml vendored Normal file
View File

@ -0,0 +1,72 @@
labels: ["enhancement"]
body:
- type: markdown
attributes:
value: |
Thanks for suggesting a new feature! Help us understand your proposal by providing detailed information.
- type: textarea
attributes:
label: Feature Description
description: Provide a clear and concise description of the feature you'd like
placeholder: I would like webpack to support...
validations:
required: true
- type: textarea
attributes:
label: Goals
description: What problems would this feature solve?
value: |
1.
2.
3.
validations:
required: true
- type: textarea
attributes:
label: Current Behavior
description: How does webpack currently handle this use case?
placeholder: Currently, webpack requires users to...
validations:
required: true
- type: textarea
attributes:
label: Proposed Solution
description: How should this feature work? Include API examples if applicable
placeholder: |
I propose adding a new option:
```js
module.exports = {
newFeature: {
enabled: true
}
}
```
validations:
required: true
- type: textarea
attributes:
label: Alternatives Considered
description: What other solutions have you considered?
placeholder: |
- Using plugin X, but it doesn't support Y
- Writing custom loader, but it's too complex
- Current workaround using...
validations:
required: false
- type: textarea
attributes:
label: Use Cases
description: Provide specific examples of how this feature would be used
placeholder: |
This would be useful for:
- Projects that need to...
- When building applications with...
- Teams that want to...
validations:
required: true

23
.github/DISCUSSION_TEMPLATE/other.yml vendored Normal file
View File

@ -0,0 +1,23 @@
labels: ["discussion"]
body:
- type: markdown
attributes:
value: |
This template is for general discussions that don't fit into Q&A or Ideas categories.
For bug reports, please use the [issue tracker](https://github.com/webpack/webpack/issues/new/choose).
For questions and help, consider using the [Q&A category](https://github.com/webpack/webpack/discussions/categories/q-a).
- type: textarea
attributes:
label: Context
description: Share your thoughts or any relevant background
placeholder: What would you like to discuss?
validations:
required: false
- type: input
attributes:
label: webpack version
description: What version of webpack are you using?
placeholder: "5.89.0"

70
.github/DISCUSSION_TEMPLATE/q-a.yml vendored Normal file
View File

@ -0,0 +1,70 @@
labels: ["help wanted"]
body:
- type: markdown
attributes:
value: |
Need help with webpack? You're in the right place! Before asking:
- Check the [webpack documentation](https://webpack.js.org)
- Search existing [discussions](https://github.com/webpack/webpack/discussions)
- Search existing [issues](https://github.com/webpack/webpack/issues)
- type: textarea
attributes:
label: What do you need help with?
description: Describe your problem or question clearly
placeholder: I'm trying to configure webpack to do X, but I'm getting Y instead...
validations:
required: true
- type: textarea
attributes:
label: Your webpack configuration
description: Share your webpack.config.js or relevant configuration
render: js
placeholder: |
module.exports = {
entry: './src/index.js',
output: {
filename: 'bundle.js'
}
}
validations:
required: false
- type: textarea
attributes:
label: Error logs
description: If you're getting errors, paste them here
render: shell
placeholder: |
ERROR in ./src/index.js
Module not found: Error: Can't resolve...
validations:
required: false
- type: input
attributes:
label: Repository
description: Link to a minimal reproduction helps us help you faster
placeholder: https://github.com/username/webpack-issue
validations:
required: false
- type: textarea
attributes:
label: What have you tried?
description: List any solutions you've already attempted
placeholder: |
- I tried adding X to my config
- I searched for similar issues and found...
- I read the documentation about Y
validations:
required: false
- type: input
attributes:
label: webpack version
description: What version of webpack are you using?
placeholder: "5.89.0"
validations:
required: true

115
.github/ISSUE_TEMPLATE/bug-report.yml vendored Normal file
View File

@ -0,0 +1,115 @@
name: Bug Report
description: Report a bug in webpack
labels: ["type: bug"]
body:
- type: markdown
attributes:
value: |
Thank you for reporting a bug! Before submitting:
- Search [existing issues](https://github.com/webpack/webpack/issues) to avoid duplicates
- Try the latest version of webpack
- For help with your project, use [Discussions](https://github.com/webpack/webpack/discussions)
⚠️ **Important**: Issues that cannot be reproduced or contain vague information will be closed. If you need help debugging your specific setup, please use [Discussions](https://github.com/webpack/webpack/discussions/new?category=q-a) instead.
- type: textarea
id: description
attributes:
label: Bug Description
description: A clear and concise description of what the bug is
placeholder: When I do X, Y happens instead of Z
validations:
required: true
- type: textarea
id: reproduction
attributes:
label: Link to Minimal Reproduction
description: |
Please provide a minimal reproduction using:
- GitHub repository with minimal webpack.config.js
**If a minimal reproduction is difficult** (e.g., performance issues in large projects with thousands of files):
- Describe your project structure in detail
- Include your full webpack configuration
- Provide specific metrics (build times, memory usage, file counts)
placeholder: |
https://github.com/user/webpack-repro
OR for complex cases:
- Build takes 30+ minutes
- Issue only appears with specific combinations of loaders/plugins
validations:
required: true
- type: textarea
id: steps
attributes:
label: Steps to Reproduce
description: Clear steps to reproduce the behavior
placeholder: |
1. Run 'npm install'
2. Run 'npm run build'
3. See error in console
validations:
required: true
- type: textarea
id: expected
attributes:
label: Expected Behavior
description: What you expected to happen
validations:
required: true
- type: textarea
id: actual
attributes:
label: Actual Behavior
description: What actually happened
validations:
required: true
- type: textarea
id: environment
attributes:
label: Environment
description: |
Please run `npx webpack info` and paste the output here
render: shell
placeholder: |
System:
OS: macOS 14.0.0
CPU: (12) arm64 Apple M1
Memory: 16.00 GB
Binaries:
Node: 22.17.0
npm: 10.0.0
Packages:
webpack: 5.100.0
validations:
required: true
- type: dropdown
id: regression
attributes:
label: Is this a regression?
description: Did this work in a previous version of webpack?
options:
- "No"
- "Yes (please specify version below)"
validations:
required: true
- type: input
id: regression-version
attributes:
label: Last Working Version
description: If regression, which version worked?
placeholder: "v5.99.9"
- type: textarea
id: additional
attributes:
label: Additional Context
description: Any other context about the problem (error logs, workarounds, etc.)

11
.github/ISSUE_TEMPLATE/config.yml vendored Normal file
View File

@ -0,0 +1,11 @@
blank_issues_enabled: true
contact_links:
- name: Feature Request
url: https://github.com/webpack/webpack/discussions/new?category=ideas
about: Request new features or suggest improvements
- name: Ask for Help
url: https://github.com/webpack/webpack/discussions/new?category=q-a
about: Ask questions and get help from the community
- name: Other Discussion
url: https://github.com/webpack/webpack/discussions/new?category=general
about: General discussions that don't fit other categories

View File

@ -314,7 +314,8 @@
"Kumar",
"spacek",
"thelarkinn",
"behaviour"
"behaviour",
"WHATWG"
],
"ignoreRegExpList": [
"/Author.+/",

View File

@ -91,28 +91,6 @@ const resolve = (browsers) => {
const anyBrowser = browsers.some((b) => /^(?!node)/.test(b));
const browserProperty = !anyBrowser ? false : anyNode ? null : true;
const nodeProperty = !anyNode ? false : anyBrowser ? null : true;
// Internet Explorer Mobile, Blackberry browser and Opera Mini are very old browsers, they do not support new features
const es6DynamicImport = rawChecker({
/* eslint-disable camelcase */
chrome: 63,
and_chr: 63,
edge: 79,
firefox: 67,
and_ff: 67,
// ie: Not supported
opera: 50,
op_mob: 46,
safari: [11, 1],
ios_saf: [11, 3],
samsung: [8, 2],
android: 63,
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
kaios: [3, 0],
node: [12, 17]
/* eslint-enable camelcase */
});
return {
/* eslint-disable camelcase */
@ -175,9 +153,9 @@ const resolve = (browsers) => {
ios_saf: 7,
samsung: [3, 0],
android: 38,
// and_qq: Unknown support
and_qq: [10, 4],
// baidu: Unknown support
// and_uc: Unknown support
and_uc: [12, 12],
kaios: [3, 0],
node: [0, 12]
}),
@ -194,9 +172,9 @@ const resolve = (browsers) => {
ios_saf: 8,
samsung: [5, 0],
android: 49,
// and_qq: Unknown support
and_qq: [10, 4],
// baidu: Unknown support
// and_uc: Unknown support
and_uc: [12, 12],
kaios: [2, 5],
node: [6, 0]
}),
@ -240,8 +218,44 @@ const resolve = (browsers) => {
kaios: [3, 0],
node: [12, 17]
}),
dynamicImport: es6DynamicImport,
dynamicImportInWorker: es6DynamicImport && !anyNode,
dynamicImport: rawChecker({
chrome: 63,
and_chr: 63,
edge: 79,
firefox: 67,
and_ff: 67,
// ie: Not supported
opera: 50,
op_mob: 46,
safari: [11, 1],
ios_saf: [11, 3],
samsung: [8, 2],
android: 63,
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
kaios: [3, 0],
node: [12, 17]
}),
dynamicImportInWorker: rawChecker({
chrome: 80,
and_chr: 80,
edge: 80,
firefox: 114,
and_ff: 114,
// ie: Not supported
opera: 67,
op_mob: 57,
safari: [15, 0],
ios_saf: [15, 0],
samsung: [13, 0],
android: 80,
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
kaios: [3, 0],
node: [12, 17]
}),
// browserslist does not have info about globalThis
// so this is based on mdn-browser-compat-data
globalThis: rawChecker({
@ -257,9 +271,9 @@ const resolve = (browsers) => {
ios_saf: [12, 2],
samsung: [10, 1],
android: 71,
// and_qq: Unknown support
and_qq: [13, 1],
// baidu: Unknown support
// and_uc: Unknown support
and_uc: [15, 5],
kaios: [3, 0],
node: 12
}),
@ -276,9 +290,9 @@ const resolve = (browsers) => {
ios_saf: [13, 4],
samsung: 13,
android: 80,
// and_qq: Not supported
and_qq: [13, 1],
// baidu: Not supported
// and_uc: Not supported
and_uc: [15, 5],
kaios: [3, 0],
node: 14
}),
@ -314,9 +328,9 @@ const resolve = (browsers) => {
ios_saf: 11,
samsung: [6, 2],
android: 55,
and_qq: [13, 1],
and_qq: [10, 4],
baidu: [13, 18],
and_uc: [15, 5],
and_uc: [12, 12],
kaios: 3,
node: [7, 6]
}),
@ -332,7 +346,7 @@ const resolve = (browsers) => {
fetchWasm: browserProperty,
global: nodeProperty,
importScripts: false,
importScriptsInWorker: true,
importScriptsInWorker: Boolean(browserProperty),
nodeBuiltins: nodeProperty,
nodePrefixForCoreModules:
nodeProperty &&

View File

@ -2909,12 +2909,6 @@ describe("Targets", () => {
- Expected
+ Received
@@ ... @@
- "dynamicImportInWorker": true,
+ "dynamicImportInWorker": false,
@@ ... @@
- "dynamicImportInWorker": true,
+ "dynamicImportInWorker": false,
@@ ... @@
- "target": "node12.17",
+ "target": "browserslist: node 12.17",

View File

@ -31,6 +31,37 @@ Object {
}
`;
exports[`browserslist target ["and_chr 140","and_ff 142","and_qq 14.9","and_uc 15.5","android 140","chrome 140","chrome 139","chrome 138","chrome 137","chrome 112","chrome 109","chrome 105","edge 140","edge 139","edge 138","firefox 143","firefox 142","firefox 141","firefox 140","ios_saf 26.0","ios_saf 18.5-18.6","kaios 3.0-3.1","node 24.8.0","node 22.19.0","node 20.19.0","op_mob 80","opera 122","opera 121","opera 120","safari 26.0","safari 18.5-18.6","samsung 28","samsung 27"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": true,
"bigIntLiteral": true,
"browser": null,
"const": true,
"destructuring": true,
"document": null,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": null,
"forOf": true,
"global": null,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": false,
"module": true,
"node": null,
"nodeBuiltins": null,
"nodePrefixForCoreModules": null,
"nwjs": false,
"optionalChaining": true,
"require": null,
"templateLiteral": true,
"web": null,
"webworker": false,
}
`;
exports[`browserslist target ["and_ff 68"] 1`] = `
Object {
"arrowFunction": true,
@ -41,7 +72,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -65,17 +96,17 @@ Object {
exports[`browserslist target ["and_qq 10.4"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": false,
"asyncFunction": true,
"bigIntLiteral": false,
"browser": true,
"const": true,
"destructuring": false,
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": true,
"forOf": false,
"forOf": true,
"global": false,
"globalThis": false,
"importScripts": false,
@ -93,37 +124,6 @@ Object {
}
`;
exports[`browserslist target ["and_uc 12.12"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": false,
"bigIntLiteral": false,
"browser": true,
"const": true,
"destructuring": false,
"document": true,
"dynamicImport": false,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": false,
"global": false,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"module": false,
"node": false,
"nodeBuiltins": false,
"nodePrefixForCoreModules": false,
"nwjs": false,
"optionalChaining": false,
"require": false,
"templateLiteral": true,
"web": true,
"webworker": false,
}
`;
exports[`browserslist target ["android 4"] 1`] = `
Object {
"arrowFunction": false,
@ -320,14 +320,45 @@ Object {
"destructuring": true,
"document": null,
"dynamicImport": true,
"dynamicImportInWorker": false,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": null,
"forOf": true,
"global": null,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": true,
"node": null,
"nodeBuiltins": null,
"nodePrefixForCoreModules": null,
"nwjs": false,
"optionalChaining": false,
"require": null,
"templateLiteral": true,
"web": null,
"webworker": false,
}
`;
exports[`browserslist target ["chrome 80","node 13.12.0"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": true,
"bigIntLiteral": true,
"browser": null,
"const": true,
"destructuring": true,
"document": null,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": null,
"forOf": true,
"global": null,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": false,
"module": true,
"node": null,
"nodeBuiltins": null,
@ -382,7 +413,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -413,7 +444,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -444,7 +475,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -537,7 +568,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -606,7 +637,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -637,7 +668,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -668,7 +699,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -699,7 +730,7 @@ Object {
"global": true,
"globalThis": false,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": false,
"node": true,
"nodeBuiltins": true,
@ -723,14 +754,45 @@ Object {
"destructuring": true,
"document": false,
"dynamicImport": true,
"dynamicImportInWorker": false,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": false,
"forOf": true,
"global": true,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": true,
"importScriptsInWorker": false,
"module": true,
"node": true,
"nodeBuiltins": true,
"nodePrefixForCoreModules": false,
"nwjs": false,
"optionalChaining": false,
"require": true,
"templateLiteral": true,
"web": false,
"webworker": false,
}
`;
exports[`browserslist target ["node 13.12.0"] 1`] = `
Object {
"arrowFunction": true,
"asyncFunction": true,
"bigIntLiteral": true,
"browser": false,
"const": true,
"destructuring": true,
"document": false,
"dynamicImport": true,
"dynamicImportInWorker": true,
"electron": false,
"fetchWasm": false,
"forOf": true,
"global": true,
"globalThis": true,
"importScripts": false,
"importScriptsInWorker": false,
"module": true,
"node": true,
"nodeBuiltins": true,
@ -785,7 +847,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -816,7 +878,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -909,7 +971,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -940,7 +1002,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -971,7 +1033,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -1064,7 +1126,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,
@ -1095,7 +1157,7 @@ Object {
"destructuring": true,
"document": true,
"dynamicImport": true,
"dynamicImportInWorker": true,
"dynamicImportInWorker": false,
"electron": false,
"fetchWasm": true,
"forOf": true,

View File

@ -15,7 +15,7 @@ module.exports = {
"destructuring": true,
"document": false,
"dynamicImport": true,
"dynamicImportInWorker": false,
"dynamicImportInWorker": true,
"forOf": true,
"globalThis": true,
"module": true,

View File

@ -15,7 +15,7 @@ module.exports = {
"destructuring": true,
"document": false,
"dynamicImport": true,
"dynamicImportInWorker": false,
"dynamicImportInWorker": true,
"forOf": true,
"globalThis": true,
"module": true,

View File

@ -3,7 +3,7 @@ import * as style from "./style.css";
import * as text1 from "./text-with-bom.txt";
import * as text2 from "./test-without-bom.text";
it("should remove BOM", function() {
it("should remove BOM", async function() {
const url = new URL("./resource-with-bom.ext", import.meta.url);
expect(mod).toBeDefined();
@ -13,7 +13,7 @@ it("should remove BOM", function() {
expect(url).toBeDefined();
const module = "module.js"
const modules = import("./dir/" + module);
const modules = await import("./dir/" + module);
expect(modules).toBeDefined();
});

View File

@ -4,6 +4,9 @@ const fs = require("fs");
const path = require("path");
module.exports = {
findBundle() {
return ["dir_module_js.bundle0.js", "bundle0.js"];
},
afterExecute(options) {
const outputPath = options.output.path;
const files = fs.readdirSync(outputPath);

View File

@ -6,6 +6,9 @@ module.exports = {
output: {
assetModuleFilename: "[name][ext]"
},
optimization: {
chunkIds: "named"
},
module: {
rules: [
{

View File

@ -1,27 +1,39 @@
it("should set fetchPriority", () => {
import(/* webpackFetchPriority: "high" */ "./a");
function abortable(fn) {
return new Promise((resolve) => {
const timeoutId = setTimeout(() => {
fn = undefined;
resolve('Promise resolved after delay');
clearTimeout(timeoutId);
}, 1000);
return fn();
});
}
it("should set fetchPriority", async () => {
abortable(() => import(/* webpackFetchPriority: "high" */ "./a"));
expect(document.head._children).toHaveLength(4);
const script1 = document.head._children[2];
expect(script1._attributes.fetchpriority).toBe("high");
import(/* webpackFetchPriority: "low" */ "./b");
abortable(() => import(/* webpackFetchPriority: "low" */ "./b"));
expect(document.head._children).toHaveLength(5);
const script2 = document.head._children[4];
expect(script2._attributes.fetchpriority).toBe("low");
import(/* webpackFetchPriority: "low" */ "./c");
abortable(() => import(/* webpackFetchPriority: "low" */ "./c"));
expect(document.head._children).toHaveLength(6);
const script3 = document.head._children[5];
expect(script3._attributes.fetchpriority).toBe("low");
import(/* webpackPrefetch: 20, webpackFetchPriority: "auto" */ "./c");
abortable(() => import(/* webpackPrefetch: 20, webpackFetchPriority: "auto" */ "./c"));
import("./d")
abortable(() => import("./d"))
expect(document.head._children).toHaveLength(7);
const script4 = document.head._children[6];
expect(script4._attributes.fetchpriority).toBeUndefined();
import(/* webpackPrefetch: -20 */ "./d3");
abortable(() => import(/* webpackPrefetch: -20 */ "./d3"));
expect(document.head._children).toHaveLength(8);
const script5 = document.head._children[7];
expect(script5._attributes.fetchpriority).toBeUndefined();
@ -29,12 +41,12 @@ it("should set fetchPriority", () => {
const condition = true;
if (!condition) {
import(/* webpackFetchPriority: "high", webpackChunkName: "one" */ "./e");
abortable( () => import(/* webpackFetchPriority: "high", webpackChunkName: "one" */ "./e"));
expect(document.head._children).toHaveLength(9);
const script6 = document.head._children[8];
expect(script6._attributes.fetchpriority).toBe("high");
} else {
import(/* webpackFetchPriority: "low", webpackChunkName: "two" */ "./e");
abortable(() => import(/* webpackFetchPriority: "low", webpackChunkName: "two" */ "./e"));
expect(document.head._children).toHaveLength(9);
const script6 = document.head._children[8];
expect(script6._attributes.fetchpriority).toBe("low");

View File

@ -1,13 +1,25 @@
function abortable(fn) {
return new Promise((resolve) => {
const timeoutId = setTimeout(() => {
fn = undefined;
resolve('Promise resolved after delay');
clearTimeout(timeoutId);
}, 1000);
return fn();
});
}
it("should set fetchPriority", () => {
// Single Chunk
import(/* webpackFetchPriority: "high" */ "./a");
abortable(() => import(/* webpackFetchPriority: "high" */ "./a"));
expect(document.head._children).toHaveLength(1);
const script1 = document.head._children[0];
expect(script1._attributes.fetchpriority).toBe("high");
// Multiple Chunks
import(/* webpackFetchPriority: "high" */ "./b");
import(/* webpackFetchPriority: "high" */ "./b2");
abortable(() => import(/* webpackFetchPriority: "high" */ "./b"));
abortable(() => import(/* webpackFetchPriority: "high" */ "./b2"));
expect(document.head._children).toHaveLength(4);
const script2 = document.head._children[1];
const script3 = document.head._children[2];
@ -17,19 +29,19 @@ it("should set fetchPriority", () => {
expect(script4._attributes.fetchpriority).toBe("high");
// Single Chunk, low
import(/* webpackFetchPriority: "low" */ "./c");
abortable(() => import(/* webpackFetchPriority: "low" */ "./c"));
expect(document.head._children).toHaveLength(5);
const script5 = document.head._children[4];
expect(script5._attributes.fetchpriority).toBe("low");
// Single Chunk, auto
import(/* webpackFetchPriority: "auto" */ "./d");
abortable(() => import(/* webpackFetchPriority: "auto" */ "./d"));
expect(document.head._children).toHaveLength(6);
const script6 = document.head._children[5];
expect(script6._attributes.fetchpriority).toBe("auto");
// No fetch priority
import("./e");
abortable(() => import("./e"));
expect(document.head._children).toHaveLength(7);
const script7 = document.head._children[6];
expect(script7._attributes.fetchpriority).toBeUndefined();
@ -44,49 +56,49 @@ it("should set fetchPriority", () => {
const script8 = document.head._children[7];
expect(script8._attributes.fetchpriority).toBeUndefined();
import(/* webpackFetchPriority: "auto" */ "./g");
abortable(() => import(/* webpackFetchPriority: "auto" */ "./g"));
expect(document.head._children).toHaveLength(9);
const script9 = document.head._children[8];
expect(script9._attributes.fetchpriority).toBe("auto");
import(/* webpackFetchPriority: "unknown" */ "./h.js");
abortable(() => import(/* webpackFetchPriority: "unknown" */ "./h.js"));
expect(document.head._children).toHaveLength(10);
const script10 = document.head._children[9];
expect(script10._attributes.fetchpriority).toBeUndefined();
import(/* webpackFetchPriority: "high" */ "./i");
import(/* webpackFetchPriority: "low" */ "./i");
abortable(() => import(/* webpackFetchPriority: "high" */ "./i"));
abortable(() => import(/* webpackFetchPriority: "low" */ "./i"));
expect(document.head._children).toHaveLength(11);
const script11 = document.head._children[10];
expect(script11._attributes.fetchpriority).toBe("high");
import(/* webpackFetchPriority: "low" */ "./j");
import(/* webpackFetchPriority: "high" */ "./j");
abortable(() => import(/* webpackFetchPriority: "low" */ "./j"));
abortable(() => import(/* webpackFetchPriority: "high" */ "./j"));
expect(document.head._children).toHaveLength(12);
const script12 = document.head._children[11];
expect(script12._attributes.fetchpriority).toBe("low");
import(/* webpackFetchPriority: "low" */ "./k");
import("./e");
import(/* webpackFetchPriority: "high" */ "./k");
expect(document.head._children).toHaveLength(13);
abortable(() => import(/* webpackFetchPriority: "low" */ "./k"));
abortable(() => import("./e"));
abortable(() => import(/* webpackFetchPriority: "high" */ "./k"));
abortable(() => expect(document.head._children).toHaveLength(13));
const script13 = document.head._children[12];
expect(script13._attributes.fetchpriority).toBe("low");
__non_webpack_require__("./125.js");
import(/* webpackFetchPriority: "high" */ "./style.css");
abortable(() => import(/* webpackFetchPriority: "high" */ "./style.css"));
expect(document.head._children).toHaveLength(14);
const link1 = document.head._children[13];
expect(link1._attributes.fetchpriority).toBe("high");
__non_webpack_require__("./499.js");
import("./style-1.css");
abortable(() => import("./style-1.css"));
expect(document.head._children).toHaveLength(15);
const link2 = document.head._children[14];
expect(link2._attributes.fetchpriority).toBeUndefined();
__non_webpack_require__("./616.js");
import(/* webpackFetchPriority: "low" */ "./style-2.css");
abortable(() => import(/* webpackFetchPriority: "low" */ "./style-2.css"));
expect(document.head._children).toHaveLength(16);
const link3 = document.head._children[15];
expect(link3._attributes.fetchpriority).toBe("low");

View File

@ -57,9 +57,7 @@ describe("browserslist target", () => {
["node 10.0.0"],
["node 10.17.0"],
["node 12.19.0"],
// UC browsers for Android
["and_uc 12.12"],
["node 13.12.0"],
// QQ browser
["and_qq 10.4"],
@ -73,6 +71,45 @@ describe("browserslist target", () => {
// Multiple
["firefox 80", "chrome 80"],
["chrome 80", "node 12.19.0"],
["chrome 80", "node 13.12.0"],
// defaults and fully supports es6-module
// maintained node versions
[
"and_chr 140",
"and_ff 142",
"and_qq 14.9",
"and_uc 15.5",
"android 140",
"chrome 140",
"chrome 139",
"chrome 138",
"chrome 137",
"chrome 112",
"chrome 109",
"chrome 105",
"edge 140",
"edge 139",
"edge 138",
"firefox 143",
"firefox 142",
"firefox 141",
"firefox 140",
"ios_saf 26.0",
"ios_saf 18.5-18.6",
"kaios 3.0-3.1",
"node 24.8.0",
"node 22.19.0",
"node 20.19.0",
"op_mob 80",
"opera 122",
"opera 121",
"opera 120",
"safari 26.0",
"safari 18.5-18.6",
"samsung 28",
"samsung 27"
],
// Unknown
["unknown 50"]

View File

@ -17,7 +17,7 @@ module.exports = {
]
},
plugins: [
new webpack.ProgressPlugin(),
new webpack.ProgressPlugin(() => {}),
{
apply(compiler) {
compiler.hooks.done.tapPromise("CacheTest", async () => {

View File

@ -16,7 +16,7 @@ module.exports = {
]
},
plugins: [
new webpack.ProgressPlugin(),
new webpack.ProgressPlugin(() => {}),
{
apply(compiler) {
compiler.hooks.done.tapPromise("CacheTest", async () => {