mirror of https://github.com/webpack/webpack.git
Compare commits
6 Commits
ac282a4988
...
77df87468b
| Author | SHA1 | Date |
|---|---|---|
|
|
77df87468b | |
|
|
e1afcd4cc2 | |
|
|
d45073a2b3 | |
|
|
44db038779 | |
|
|
b8aaeac1de | |
|
|
8823af17f5 |
|
|
@ -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
|
||||||
|
|
@ -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"
|
||||||
|
|
@ -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
|
||||||
|
|
@ -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.)
|
||||||
|
|
@ -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
|
||||||
|
|
@ -314,7 +314,8 @@
|
||||||
"Kumar",
|
"Kumar",
|
||||||
"spacek",
|
"spacek",
|
||||||
"thelarkinn",
|
"thelarkinn",
|
||||||
"behaviour"
|
"behaviour",
|
||||||
|
"WHATWG"
|
||||||
],
|
],
|
||||||
"ignoreRegExpList": [
|
"ignoreRegExpList": [
|
||||||
"/Author.+/",
|
"/Author.+/",
|
||||||
|
|
|
||||||
|
|
@ -91,28 +91,6 @@ const resolve = (browsers) => {
|
||||||
const anyBrowser = browsers.some((b) => /^(?!node)/.test(b));
|
const anyBrowser = browsers.some((b) => /^(?!node)/.test(b));
|
||||||
const browserProperty = !anyBrowser ? false : anyNode ? null : true;
|
const browserProperty = !anyBrowser ? false : anyNode ? null : true;
|
||||||
const nodeProperty = !anyNode ? false : anyBrowser ? 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 {
|
return {
|
||||||
/* eslint-disable camelcase */
|
/* eslint-disable camelcase */
|
||||||
|
|
@ -175,9 +153,9 @@ const resolve = (browsers) => {
|
||||||
ios_saf: 7,
|
ios_saf: 7,
|
||||||
samsung: [3, 0],
|
samsung: [3, 0],
|
||||||
android: 38,
|
android: 38,
|
||||||
// and_qq: Unknown support
|
and_qq: [10, 4],
|
||||||
// baidu: Unknown support
|
// baidu: Unknown support
|
||||||
// and_uc: Unknown support
|
and_uc: [12, 12],
|
||||||
kaios: [3, 0],
|
kaios: [3, 0],
|
||||||
node: [0, 12]
|
node: [0, 12]
|
||||||
}),
|
}),
|
||||||
|
|
@ -194,9 +172,9 @@ const resolve = (browsers) => {
|
||||||
ios_saf: 8,
|
ios_saf: 8,
|
||||||
samsung: [5, 0],
|
samsung: [5, 0],
|
||||||
android: 49,
|
android: 49,
|
||||||
// and_qq: Unknown support
|
and_qq: [10, 4],
|
||||||
// baidu: Unknown support
|
// baidu: Unknown support
|
||||||
// and_uc: Unknown support
|
and_uc: [12, 12],
|
||||||
kaios: [2, 5],
|
kaios: [2, 5],
|
||||||
node: [6, 0]
|
node: [6, 0]
|
||||||
}),
|
}),
|
||||||
|
|
@ -240,8 +218,44 @@ const resolve = (browsers) => {
|
||||||
kaios: [3, 0],
|
kaios: [3, 0],
|
||||||
node: [12, 17]
|
node: [12, 17]
|
||||||
}),
|
}),
|
||||||
dynamicImport: es6DynamicImport,
|
dynamicImport: rawChecker({
|
||||||
dynamicImportInWorker: es6DynamicImport && !anyNode,
|
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
|
// browserslist does not have info about globalThis
|
||||||
// so this is based on mdn-browser-compat-data
|
// so this is based on mdn-browser-compat-data
|
||||||
globalThis: rawChecker({
|
globalThis: rawChecker({
|
||||||
|
|
@ -257,9 +271,9 @@ const resolve = (browsers) => {
|
||||||
ios_saf: [12, 2],
|
ios_saf: [12, 2],
|
||||||
samsung: [10, 1],
|
samsung: [10, 1],
|
||||||
android: 71,
|
android: 71,
|
||||||
// and_qq: Unknown support
|
and_qq: [13, 1],
|
||||||
// baidu: Unknown support
|
// baidu: Unknown support
|
||||||
// and_uc: Unknown support
|
and_uc: [15, 5],
|
||||||
kaios: [3, 0],
|
kaios: [3, 0],
|
||||||
node: 12
|
node: 12
|
||||||
}),
|
}),
|
||||||
|
|
@ -276,9 +290,9 @@ const resolve = (browsers) => {
|
||||||
ios_saf: [13, 4],
|
ios_saf: [13, 4],
|
||||||
samsung: 13,
|
samsung: 13,
|
||||||
android: 80,
|
android: 80,
|
||||||
// and_qq: Not supported
|
and_qq: [13, 1],
|
||||||
// baidu: Not supported
|
// baidu: Not supported
|
||||||
// and_uc: Not supported
|
and_uc: [15, 5],
|
||||||
kaios: [3, 0],
|
kaios: [3, 0],
|
||||||
node: 14
|
node: 14
|
||||||
}),
|
}),
|
||||||
|
|
@ -314,9 +328,9 @@ const resolve = (browsers) => {
|
||||||
ios_saf: 11,
|
ios_saf: 11,
|
||||||
samsung: [6, 2],
|
samsung: [6, 2],
|
||||||
android: 55,
|
android: 55,
|
||||||
and_qq: [13, 1],
|
and_qq: [10, 4],
|
||||||
baidu: [13, 18],
|
baidu: [13, 18],
|
||||||
and_uc: [15, 5],
|
and_uc: [12, 12],
|
||||||
kaios: 3,
|
kaios: 3,
|
||||||
node: [7, 6]
|
node: [7, 6]
|
||||||
}),
|
}),
|
||||||
|
|
@ -332,7 +346,7 @@ const resolve = (browsers) => {
|
||||||
fetchWasm: browserProperty,
|
fetchWasm: browserProperty,
|
||||||
global: nodeProperty,
|
global: nodeProperty,
|
||||||
importScripts: false,
|
importScripts: false,
|
||||||
importScriptsInWorker: true,
|
importScriptsInWorker: Boolean(browserProperty),
|
||||||
nodeBuiltins: nodeProperty,
|
nodeBuiltins: nodeProperty,
|
||||||
nodePrefixForCoreModules:
|
nodePrefixForCoreModules:
|
||||||
nodeProperty &&
|
nodeProperty &&
|
||||||
|
|
|
||||||
|
|
@ -2909,12 +2909,6 @@ describe("Targets", () => {
|
||||||
- Expected
|
- Expected
|
||||||
+ Received
|
+ Received
|
||||||
|
|
||||||
@@ ... @@
|
|
||||||
- "dynamicImportInWorker": true,
|
|
||||||
+ "dynamicImportInWorker": false,
|
|
||||||
@@ ... @@
|
|
||||||
- "dynamicImportInWorker": true,
|
|
||||||
+ "dynamicImportInWorker": false,
|
|
||||||
@@ ... @@
|
@@ ... @@
|
||||||
- "target": "node12.17",
|
- "target": "node12.17",
|
||||||
+ "target": "browserslist: node 12.17",
|
+ "target": "browserslist: node 12.17",
|
||||||
|
|
|
||||||
|
|
@ -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`] = `
|
exports[`browserslist target ["and_ff 68"] 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"arrowFunction": true,
|
"arrowFunction": true,
|
||||||
|
|
@ -41,7 +72,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -65,17 +96,17 @@ Object {
|
||||||
exports[`browserslist target ["and_qq 10.4"] 1`] = `
|
exports[`browserslist target ["and_qq 10.4"] 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"arrowFunction": true,
|
"arrowFunction": true,
|
||||||
"asyncFunction": false,
|
"asyncFunction": true,
|
||||||
"bigIntLiteral": false,
|
"bigIntLiteral": false,
|
||||||
"browser": true,
|
"browser": true,
|
||||||
"const": true,
|
"const": true,
|
||||||
"destructuring": false,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": true,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": false,
|
"forOf": true,
|
||||||
"global": false,
|
"global": false,
|
||||||
"globalThis": false,
|
"globalThis": false,
|
||||||
"importScripts": 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`] = `
|
exports[`browserslist target ["android 4"] 1`] = `
|
||||||
Object {
|
Object {
|
||||||
"arrowFunction": false,
|
"arrowFunction": false,
|
||||||
|
|
@ -320,14 +320,45 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": null,
|
"document": null,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": false,
|
"dynamicImportInWorker": true,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": null,
|
"fetchWasm": null,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
"global": null,
|
"global": null,
|
||||||
"globalThis": true,
|
"globalThis": true,
|
||||||
"importScripts": false,
|
"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,
|
"module": true,
|
||||||
"node": null,
|
"node": null,
|
||||||
"nodeBuiltins": null,
|
"nodeBuiltins": null,
|
||||||
|
|
@ -382,7 +413,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -413,7 +444,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -444,7 +475,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -537,7 +568,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -606,7 +637,7 @@ Object {
|
||||||
"global": true,
|
"global": true,
|
||||||
"globalThis": false,
|
"globalThis": false,
|
||||||
"importScripts": false,
|
"importScripts": false,
|
||||||
"importScriptsInWorker": true,
|
"importScriptsInWorker": false,
|
||||||
"module": false,
|
"module": false,
|
||||||
"node": true,
|
"node": true,
|
||||||
"nodeBuiltins": true,
|
"nodeBuiltins": true,
|
||||||
|
|
@ -637,7 +668,7 @@ Object {
|
||||||
"global": true,
|
"global": true,
|
||||||
"globalThis": false,
|
"globalThis": false,
|
||||||
"importScripts": false,
|
"importScripts": false,
|
||||||
"importScriptsInWorker": true,
|
"importScriptsInWorker": false,
|
||||||
"module": false,
|
"module": false,
|
||||||
"node": true,
|
"node": true,
|
||||||
"nodeBuiltins": true,
|
"nodeBuiltins": true,
|
||||||
|
|
@ -668,7 +699,7 @@ Object {
|
||||||
"global": true,
|
"global": true,
|
||||||
"globalThis": false,
|
"globalThis": false,
|
||||||
"importScripts": false,
|
"importScripts": false,
|
||||||
"importScriptsInWorker": true,
|
"importScriptsInWorker": false,
|
||||||
"module": false,
|
"module": false,
|
||||||
"node": true,
|
"node": true,
|
||||||
"nodeBuiltins": true,
|
"nodeBuiltins": true,
|
||||||
|
|
@ -699,7 +730,7 @@ Object {
|
||||||
"global": true,
|
"global": true,
|
||||||
"globalThis": false,
|
"globalThis": false,
|
||||||
"importScripts": false,
|
"importScripts": false,
|
||||||
"importScriptsInWorker": true,
|
"importScriptsInWorker": false,
|
||||||
"module": false,
|
"module": false,
|
||||||
"node": true,
|
"node": true,
|
||||||
"nodeBuiltins": true,
|
"nodeBuiltins": true,
|
||||||
|
|
@ -723,14 +754,45 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": false,
|
"document": false,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": false,
|
"dynamicImportInWorker": true,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": false,
|
"fetchWasm": false,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
"global": true,
|
"global": true,
|
||||||
"globalThis": true,
|
"globalThis": true,
|
||||||
"importScripts": false,
|
"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,
|
"module": true,
|
||||||
"node": true,
|
"node": true,
|
||||||
"nodeBuiltins": true,
|
"nodeBuiltins": true,
|
||||||
|
|
@ -785,7 +847,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -816,7 +878,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -909,7 +971,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -940,7 +1002,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -971,7 +1033,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -1064,7 +1126,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
@ -1095,7 +1157,7 @@ Object {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": true,
|
"document": true,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": true,
|
"dynamicImportInWorker": false,
|
||||||
"electron": false,
|
"electron": false,
|
||||||
"fetchWasm": true,
|
"fetchWasm": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ module.exports = {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": false,
|
"document": false,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": false,
|
"dynamicImportInWorker": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
"globalThis": true,
|
"globalThis": true,
|
||||||
"module": true,
|
"module": true,
|
||||||
|
|
|
||||||
|
|
@ -15,7 +15,7 @@ module.exports = {
|
||||||
"destructuring": true,
|
"destructuring": true,
|
||||||
"document": false,
|
"document": false,
|
||||||
"dynamicImport": true,
|
"dynamicImport": true,
|
||||||
"dynamicImportInWorker": false,
|
"dynamicImportInWorker": true,
|
||||||
"forOf": true,
|
"forOf": true,
|
||||||
"globalThis": true,
|
"globalThis": true,
|
||||||
"module": true,
|
"module": true,
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ import * as style from "./style.css";
|
||||||
import * as text1 from "./text-with-bom.txt";
|
import * as text1 from "./text-with-bom.txt";
|
||||||
import * as text2 from "./test-without-bom.text";
|
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);
|
const url = new URL("./resource-with-bom.ext", import.meta.url);
|
||||||
|
|
||||||
expect(mod).toBeDefined();
|
expect(mod).toBeDefined();
|
||||||
|
|
@ -13,7 +13,7 @@ it("should remove BOM", function() {
|
||||||
expect(url).toBeDefined();
|
expect(url).toBeDefined();
|
||||||
|
|
||||||
const module = "module.js"
|
const module = "module.js"
|
||||||
const modules = import("./dir/" + module);
|
const modules = await import("./dir/" + module);
|
||||||
|
|
||||||
expect(modules).toBeDefined();
|
expect(modules).toBeDefined();
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -4,6 +4,9 @@ const fs = require("fs");
|
||||||
const path = require("path");
|
const path = require("path");
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
|
findBundle() {
|
||||||
|
return ["dir_module_js.bundle0.js", "bundle0.js"];
|
||||||
|
},
|
||||||
afterExecute(options) {
|
afterExecute(options) {
|
||||||
const outputPath = options.output.path;
|
const outputPath = options.output.path;
|
||||||
const files = fs.readdirSync(outputPath);
|
const files = fs.readdirSync(outputPath);
|
||||||
|
|
|
||||||
|
|
@ -6,6 +6,9 @@ module.exports = {
|
||||||
output: {
|
output: {
|
||||||
assetModuleFilename: "[name][ext]"
|
assetModuleFilename: "[name][ext]"
|
||||||
},
|
},
|
||||||
|
optimization: {
|
||||||
|
chunkIds: "named"
|
||||||
|
},
|
||||||
module: {
|
module: {
|
||||||
rules: [
|
rules: [
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -1,27 +1,39 @@
|
||||||
it("should set fetchPriority", () => {
|
function abortable(fn) {
|
||||||
import(/* webpackFetchPriority: "high" */ "./a");
|
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);
|
expect(document.head._children).toHaveLength(4);
|
||||||
const script1 = document.head._children[2];
|
const script1 = document.head._children[2];
|
||||||
expect(script1._attributes.fetchpriority).toBe("high");
|
expect(script1._attributes.fetchpriority).toBe("high");
|
||||||
|
|
||||||
import(/* webpackFetchPriority: "low" */ "./b");
|
abortable(() => import(/* webpackFetchPriority: "low" */ "./b"));
|
||||||
expect(document.head._children).toHaveLength(5);
|
expect(document.head._children).toHaveLength(5);
|
||||||
const script2 = document.head._children[4];
|
const script2 = document.head._children[4];
|
||||||
expect(script2._attributes.fetchpriority).toBe("low");
|
expect(script2._attributes.fetchpriority).toBe("low");
|
||||||
|
|
||||||
import(/* webpackFetchPriority: "low" */ "./c");
|
abortable(() => import(/* webpackFetchPriority: "low" */ "./c"));
|
||||||
expect(document.head._children).toHaveLength(6);
|
expect(document.head._children).toHaveLength(6);
|
||||||
const script3 = document.head._children[5];
|
const script3 = document.head._children[5];
|
||||||
expect(script3._attributes.fetchpriority).toBe("low");
|
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);
|
expect(document.head._children).toHaveLength(7);
|
||||||
const script4 = document.head._children[6];
|
const script4 = document.head._children[6];
|
||||||
expect(script4._attributes.fetchpriority).toBeUndefined();
|
expect(script4._attributes.fetchpriority).toBeUndefined();
|
||||||
|
|
||||||
import(/* webpackPrefetch: -20 */ "./d3");
|
abortable(() => import(/* webpackPrefetch: -20 */ "./d3"));
|
||||||
expect(document.head._children).toHaveLength(8);
|
expect(document.head._children).toHaveLength(8);
|
||||||
const script5 = document.head._children[7];
|
const script5 = document.head._children[7];
|
||||||
expect(script5._attributes.fetchpriority).toBeUndefined();
|
expect(script5._attributes.fetchpriority).toBeUndefined();
|
||||||
|
|
@ -29,12 +41,12 @@ it("should set fetchPriority", () => {
|
||||||
const condition = true;
|
const condition = true;
|
||||||
|
|
||||||
if (!condition) {
|
if (!condition) {
|
||||||
import(/* webpackFetchPriority: "high", webpackChunkName: "one" */ "./e");
|
abortable( () => import(/* webpackFetchPriority: "high", webpackChunkName: "one" */ "./e"));
|
||||||
expect(document.head._children).toHaveLength(9);
|
expect(document.head._children).toHaveLength(9);
|
||||||
const script6 = document.head._children[8];
|
const script6 = document.head._children[8];
|
||||||
expect(script6._attributes.fetchpriority).toBe("high");
|
expect(script6._attributes.fetchpriority).toBe("high");
|
||||||
} else {
|
} else {
|
||||||
import(/* webpackFetchPriority: "low", webpackChunkName: "two" */ "./e");
|
abortable(() => import(/* webpackFetchPriority: "low", webpackChunkName: "two" */ "./e"));
|
||||||
expect(document.head._children).toHaveLength(9);
|
expect(document.head._children).toHaveLength(9);
|
||||||
const script6 = document.head._children[8];
|
const script6 = document.head._children[8];
|
||||||
expect(script6._attributes.fetchpriority).toBe("low");
|
expect(script6._attributes.fetchpriority).toBe("low");
|
||||||
|
|
|
||||||
|
|
@ -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", () => {
|
it("should set fetchPriority", () => {
|
||||||
// Single Chunk
|
// Single Chunk
|
||||||
import(/* webpackFetchPriority: "high" */ "./a");
|
abortable(() => import(/* webpackFetchPriority: "high" */ "./a"));
|
||||||
expect(document.head._children).toHaveLength(1);
|
expect(document.head._children).toHaveLength(1);
|
||||||
const script1 = document.head._children[0];
|
const script1 = document.head._children[0];
|
||||||
expect(script1._attributes.fetchpriority).toBe("high");
|
expect(script1._attributes.fetchpriority).toBe("high");
|
||||||
|
|
||||||
// Multiple Chunks
|
// Multiple Chunks
|
||||||
import(/* webpackFetchPriority: "high" */ "./b");
|
abortable(() => import(/* webpackFetchPriority: "high" */ "./b"));
|
||||||
import(/* webpackFetchPriority: "high" */ "./b2");
|
abortable(() => import(/* webpackFetchPriority: "high" */ "./b2"));
|
||||||
expect(document.head._children).toHaveLength(4);
|
expect(document.head._children).toHaveLength(4);
|
||||||
const script2 = document.head._children[1];
|
const script2 = document.head._children[1];
|
||||||
const script3 = document.head._children[2];
|
const script3 = document.head._children[2];
|
||||||
|
|
@ -17,19 +29,19 @@ it("should set fetchPriority", () => {
|
||||||
expect(script4._attributes.fetchpriority).toBe("high");
|
expect(script4._attributes.fetchpriority).toBe("high");
|
||||||
|
|
||||||
// Single Chunk, low
|
// Single Chunk, low
|
||||||
import(/* webpackFetchPriority: "low" */ "./c");
|
abortable(() => import(/* webpackFetchPriority: "low" */ "./c"));
|
||||||
expect(document.head._children).toHaveLength(5);
|
expect(document.head._children).toHaveLength(5);
|
||||||
const script5 = document.head._children[4];
|
const script5 = document.head._children[4];
|
||||||
expect(script5._attributes.fetchpriority).toBe("low");
|
expect(script5._attributes.fetchpriority).toBe("low");
|
||||||
|
|
||||||
// Single Chunk, auto
|
// Single Chunk, auto
|
||||||
import(/* webpackFetchPriority: "auto" */ "./d");
|
abortable(() => import(/* webpackFetchPriority: "auto" */ "./d"));
|
||||||
expect(document.head._children).toHaveLength(6);
|
expect(document.head._children).toHaveLength(6);
|
||||||
const script6 = document.head._children[5];
|
const script6 = document.head._children[5];
|
||||||
expect(script6._attributes.fetchpriority).toBe("auto");
|
expect(script6._attributes.fetchpriority).toBe("auto");
|
||||||
|
|
||||||
// No fetch priority
|
// No fetch priority
|
||||||
import("./e");
|
abortable(() => import("./e"));
|
||||||
expect(document.head._children).toHaveLength(7);
|
expect(document.head._children).toHaveLength(7);
|
||||||
const script7 = document.head._children[6];
|
const script7 = document.head._children[6];
|
||||||
expect(script7._attributes.fetchpriority).toBeUndefined();
|
expect(script7._attributes.fetchpriority).toBeUndefined();
|
||||||
|
|
@ -44,49 +56,49 @@ it("should set fetchPriority", () => {
|
||||||
const script8 = document.head._children[7];
|
const script8 = document.head._children[7];
|
||||||
expect(script8._attributes.fetchpriority).toBeUndefined();
|
expect(script8._attributes.fetchpriority).toBeUndefined();
|
||||||
|
|
||||||
import(/* webpackFetchPriority: "auto" */ "./g");
|
abortable(() => import(/* webpackFetchPriority: "auto" */ "./g"));
|
||||||
expect(document.head._children).toHaveLength(9);
|
expect(document.head._children).toHaveLength(9);
|
||||||
const script9 = document.head._children[8];
|
const script9 = document.head._children[8];
|
||||||
expect(script9._attributes.fetchpriority).toBe("auto");
|
expect(script9._attributes.fetchpriority).toBe("auto");
|
||||||
|
|
||||||
import(/* webpackFetchPriority: "unknown" */ "./h.js");
|
abortable(() => import(/* webpackFetchPriority: "unknown" */ "./h.js"));
|
||||||
expect(document.head._children).toHaveLength(10);
|
expect(document.head._children).toHaveLength(10);
|
||||||
const script10 = document.head._children[9];
|
const script10 = document.head._children[9];
|
||||||
expect(script10._attributes.fetchpriority).toBeUndefined();
|
expect(script10._attributes.fetchpriority).toBeUndefined();
|
||||||
|
|
||||||
import(/* webpackFetchPriority: "high" */ "./i");
|
abortable(() => import(/* webpackFetchPriority: "high" */ "./i"));
|
||||||
import(/* webpackFetchPriority: "low" */ "./i");
|
abortable(() => import(/* webpackFetchPriority: "low" */ "./i"));
|
||||||
expect(document.head._children).toHaveLength(11);
|
expect(document.head._children).toHaveLength(11);
|
||||||
const script11 = document.head._children[10];
|
const script11 = document.head._children[10];
|
||||||
expect(script11._attributes.fetchpriority).toBe("high");
|
expect(script11._attributes.fetchpriority).toBe("high");
|
||||||
|
|
||||||
import(/* webpackFetchPriority: "low" */ "./j");
|
abortable(() => import(/* webpackFetchPriority: "low" */ "./j"));
|
||||||
import(/* webpackFetchPriority: "high" */ "./j");
|
abortable(() => import(/* webpackFetchPriority: "high" */ "./j"));
|
||||||
expect(document.head._children).toHaveLength(12);
|
expect(document.head._children).toHaveLength(12);
|
||||||
const script12 = document.head._children[11];
|
const script12 = document.head._children[11];
|
||||||
|
|
||||||
expect(script12._attributes.fetchpriority).toBe("low");
|
expect(script12._attributes.fetchpriority).toBe("low");
|
||||||
import(/* webpackFetchPriority: "low" */ "./k");
|
abortable(() => import(/* webpackFetchPriority: "low" */ "./k"));
|
||||||
import("./e");
|
abortable(() => import("./e"));
|
||||||
import(/* webpackFetchPriority: "high" */ "./k");
|
abortable(() => import(/* webpackFetchPriority: "high" */ "./k"));
|
||||||
expect(document.head._children).toHaveLength(13);
|
abortable(() => expect(document.head._children).toHaveLength(13));
|
||||||
const script13 = document.head._children[12];
|
const script13 = document.head._children[12];
|
||||||
expect(script13._attributes.fetchpriority).toBe("low");
|
expect(script13._attributes.fetchpriority).toBe("low");
|
||||||
|
|
||||||
__non_webpack_require__("./125.js");
|
__non_webpack_require__("./125.js");
|
||||||
import(/* webpackFetchPriority: "high" */ "./style.css");
|
abortable(() => import(/* webpackFetchPriority: "high" */ "./style.css"));
|
||||||
expect(document.head._children).toHaveLength(14);
|
expect(document.head._children).toHaveLength(14);
|
||||||
const link1 = document.head._children[13];
|
const link1 = document.head._children[13];
|
||||||
expect(link1._attributes.fetchpriority).toBe("high");
|
expect(link1._attributes.fetchpriority).toBe("high");
|
||||||
|
|
||||||
__non_webpack_require__("./499.js");
|
__non_webpack_require__("./499.js");
|
||||||
import("./style-1.css");
|
abortable(() => import("./style-1.css"));
|
||||||
expect(document.head._children).toHaveLength(15);
|
expect(document.head._children).toHaveLength(15);
|
||||||
const link2 = document.head._children[14];
|
const link2 = document.head._children[14];
|
||||||
expect(link2._attributes.fetchpriority).toBeUndefined();
|
expect(link2._attributes.fetchpriority).toBeUndefined();
|
||||||
|
|
||||||
__non_webpack_require__("./616.js");
|
__non_webpack_require__("./616.js");
|
||||||
import(/* webpackFetchPriority: "low" */ "./style-2.css");
|
abortable(() => import(/* webpackFetchPriority: "low" */ "./style-2.css"));
|
||||||
expect(document.head._children).toHaveLength(16);
|
expect(document.head._children).toHaveLength(16);
|
||||||
const link3 = document.head._children[15];
|
const link3 = document.head._children[15];
|
||||||
expect(link3._attributes.fetchpriority).toBe("low");
|
expect(link3._attributes.fetchpriority).toBe("low");
|
||||||
|
|
|
||||||
|
|
@ -57,9 +57,7 @@ describe("browserslist target", () => {
|
||||||
["node 10.0.0"],
|
["node 10.0.0"],
|
||||||
["node 10.17.0"],
|
["node 10.17.0"],
|
||||||
["node 12.19.0"],
|
["node 12.19.0"],
|
||||||
|
["node 13.12.0"],
|
||||||
// UC browsers for Android
|
|
||||||
["and_uc 12.12"],
|
|
||||||
|
|
||||||
// QQ browser
|
// QQ browser
|
||||||
["and_qq 10.4"],
|
["and_qq 10.4"],
|
||||||
|
|
@ -73,6 +71,45 @@ describe("browserslist target", () => {
|
||||||
// Multiple
|
// Multiple
|
||||||
["firefox 80", "chrome 80"],
|
["firefox 80", "chrome 80"],
|
||||||
["chrome 80", "node 12.19.0"],
|
["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
|
||||||
["unknown 50"]
|
["unknown 50"]
|
||||||
|
|
|
||||||
|
|
@ -17,7 +17,7 @@ module.exports = {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.ProgressPlugin(),
|
new webpack.ProgressPlugin(() => {}),
|
||||||
{
|
{
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
compiler.hooks.done.tapPromise("CacheTest", async () => {
|
compiler.hooks.done.tapPromise("CacheTest", async () => {
|
||||||
|
|
|
||||||
|
|
@ -16,7 +16,7 @@ module.exports = {
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.ProgressPlugin(),
|
new webpack.ProgressPlugin(() => {}),
|
||||||
{
|
{
|
||||||
apply(compiler) {
|
apply(compiler) {
|
||||||
compiler.hooks.done.tapPromise("CacheTest", async () => {
|
compiler.hooks.done.tapPromise("CacheTest", async () => {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue