diff --git a/.editorconfig b/.editorconfig
index 2bd8cf9e86d..c85531eb0b5 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -17,3 +17,6 @@ charset = utf-8-bom
[*.md]
trim_trailing_whitespace = false
+
+[*.snap]
+trim_trailing_whitespace = false
diff --git a/.eslintignore b/.eslintignore
deleted file mode 100644
index f9f03214300..00000000000
--- a/.eslintignore
+++ /dev/null
@@ -1,24 +0,0 @@
-# Ignore node_modules
-node_modules
-
-# Ignore some folders
-benchmark
-coverage
-
-# Ignore not support files
-!.*.js
-.eslintrc.js
-*.d.ts
-
-# Ignore some test files
-test/*
-!test/*Cases
-!test/helpers
-!test/*.js
-test/*Cases/**/*.js
-!test/*Cases/**/webpack.config.js
-
-# Ignore some examples files
-examples/**/*.js
-!examples/*/webpack.config.js
-
diff --git a/.eslintrc.js b/.eslintrc.js
deleted file mode 100644
index 28d47e83dca..00000000000
--- a/.eslintrc.js
+++ /dev/null
@@ -1,104 +0,0 @@
-module.exports = {
- root: true,
- plugins: ["prettier", "node", "jest", "jsdoc"],
- extends: [
- "eslint:recommended",
- "plugin:node/recommended",
- "plugin:prettier/recommended"
- ],
- env: {
- node: true,
- es6: true
- },
- parserOptions: {
- ecmaVersion: 2018
- },
- rules: {
- "prettier/prettier": "error",
- "no-template-curly-in-string": "error",
- "no-caller": "error",
- "no-control-regex": "off",
- yoda: "error",
- eqeqeq: "error",
- "eol-last": "error",
- "no-extra-bind": "warn",
- "no-process-exit": "warn",
- "no-use-before-define": "off",
- "no-unused-vars": ["error", { args: "none", ignoreRestSiblings: true }],
- "no-loop-func": "warn",
- "node/no-missing-require": ["error", { allowModules: ["webpack"] }],
- "jsdoc/check-indentation": "error",
- "jsdoc/check-param-names": "error",
- "jsdoc/check-property-names": "error",
- "jsdoc/check-tag-names": "error",
- "jsdoc/require-hyphen-before-param-description": ["error", "never"],
- "jsdoc/require-param-description": "error",
- "jsdoc/require-param-name": "error",
- "jsdoc/require-param-type": "error",
- "jsdoc/require-param": "error",
- "jsdoc/require-property": "error",
- "jsdoc/require-property-name": "error",
- "jsdoc/require-property-type": "error",
- "jsdoc/require-returns-description": "error",
- "jsdoc/require-returns-type": "error",
- "jsdoc/require-returns": "error",
- // Disallow @ts-ignore directive. Use @ts-expect-error instead
- "no-warning-comments": [
- "error",
- { terms: ["@ts-ignore"], location: "start" }
- ]
- },
- settings: {
- jsdoc: {
- mode: "typescript",
- // supported tags https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md
- tagNamePreference: {
- ...["implements", "const", "memberof", "readonly", "yields"].reduce(
- (acc, tag) => {
- acc[tag] = {
- message: `@${tag} currently not supported in Typescript`
- };
- return acc;
- },
- {}
- ),
- extends: "extends",
- return: "returns",
- constructor: "constructor",
- prop: "property",
- arg: "param",
- augments: "extends",
- description: false,
- desc: false,
- inheritdoc: false,
- class: "constructor"
- },
- overrideReplacesDocs: false
- }
- },
- overrides: [
- {
- files: ["lib/**/*.runtime.js", "hot/*.js"],
- env: {
- es6: false,
- browser: true
- },
- globals: {
- Promise: false
- },
- parserOptions: {
- ecmaVersion: 5
- }
- },
- {
- files: ["test/**/*.js"],
- env: {
- "jest/globals": true
- },
- globals: {
- nsObj: false,
- jasmine: false
- }
- }
- ]
-};
diff --git a/.gitattributes b/.gitattributes
index 46ada865c8d..4a65e411fbd 100644
--- a/.gitattributes
+++ b/.gitattributes
@@ -3,3 +3,5 @@ test/statsCases/** eol=lf
examples/* eol=lf
bin/* eol=lf
*.svg eol=lf
+*.css eol=lf
+**/*webpack.lock.data/** -text
diff --git a/.github/ISSUE_TEMPLATE.md b/.github/ISSUE_TEMPLATE.md
index ba313faa478..3b257921146 100644
--- a/.github/ISSUE_TEMPLATE.md
+++ b/.github/ISSUE_TEMPLATE.md
@@ -2,9 +2,11 @@
-**Do you want to request a *feature* or report a *bug*?**
+**Do you want to request a _feature_ or report a _bug_?**
-
+
+
+
**What is the current behavior?**
diff --git a/.github/ISSUE_TEMPLATE/Bug_report.md b/.github/ISSUE_TEMPLATE/Bug_report.md
index 437637672bb..de70ffd482d 100644
--- a/.github/ISSUE_TEMPLATE/Bug_report.md
+++ b/.github/ISSUE_TEMPLATE/Bug_report.md
@@ -8,17 +8,15 @@ about: Create a report to help us improve
# Bug report
-
+
+
-
**What is the current behavior?**
-
**If the current behavior is a bug, please provide the steps to reproduce.**
-
@@ -28,12 +26,11 @@ about: Create a report to help us improve
**What is the expected behavior?**
-
**Other relevant information:**
webpack version:
-Node.js version:
-Operating System:
+Node.js version:
+Operating System:
Additional tools:
diff --git a/.github/ISSUE_TEMPLATE/Feature_request.md b/.github/ISSUE_TEMPLATE/Feature_request.md
index ff728e6db23..704020c0671 100644
--- a/.github/ISSUE_TEMPLATE/Feature_request.md
+++ b/.github/ISSUE_TEMPLATE/Feature_request.md
@@ -1,7 +1,6 @@
---
name: Feature request
about: Suggest an idea for this project
-
---
@@ -16,12 +15,9 @@ about: Suggest an idea for this project
**What is the expected behavior?**
-
**What is motivation or use case for adding/changing the behavior?**
-
**How should this be implemented in your opinion?**
-
**Are you willing to work on this yourself?**
yes
diff --git a/.github/ISSUE_TEMPLATE/Other.md b/.github/ISSUE_TEMPLATE/Other.md
index 033e88fcad4..3faf967c321 100644
--- a/.github/ISSUE_TEMPLATE/Other.md
+++ b/.github/ISSUE_TEMPLATE/Other.md
@@ -1,9 +1,10 @@
---
name: Other
about: Something else
-
---
-
+
+
+
diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md
index 8967c8f0169..89efe54b7d5 100644
--- a/.github/PULL_REQUEST_TEMPLATE.md
+++ b/.github/PULL_REQUEST_TEMPLATE.md
@@ -2,7 +2,6 @@
-
**What kind of change does this PR introduce?**
diff --git a/.github/dependabot.yml b/.github/dependabot.yml
new file mode 100644
index 00000000000..d5be4141d14
--- /dev/null
+++ b/.github/dependabot.yml
@@ -0,0 +1,31 @@
+version: 2
+updates:
+ - package-ecosystem: npm
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "04:00"
+ timezone: Europe/Berlin
+ open-pull-requests-limit: 20
+ labels:
+ - dependencies
+ versioning-strategy: widen
+ groups:
+ dependencies:
+ patterns:
+ - "*"
+ exclude-patterns:
+ - "eslint-scope"
+ - "json-parse-even-better-errors"
+ - "schema-utils"
+ - "strip-ansi"
+ - "rimraf"
+ - package-ecosystem: "github-actions"
+ directory: "/"
+ schedule:
+ interval: daily
+ time: "04:00"
+ timezone: Europe/Berlin
+ open-pull-requests-limit: 20
+ labels:
+ - dependencies
diff --git a/.github/workflows/dependency-review.yml b/.github/workflows/dependency-review.yml
new file mode 100644
index 00000000000..b14a81db447
--- /dev/null
+++ b/.github/workflows/dependency-review.yml
@@ -0,0 +1,60 @@
+name: "Dependency Review"
+
+on: [pull_request]
+
+permissions:
+ contents: read
+
+jobs:
+ dependency-review:
+ runs-on: ubuntu-latest
+ steps:
+ - name: "Checkout Repository"
+ uses: actions/checkout@v4
+ - name: "Dependency Review"
+ uses: actions/dependency-review-action@v4
+ with:
+ allow-licenses: |
+ 0BSD,
+ AFL-1.1,
+ AFL-1.2,
+ AFL-2.0,
+ AFL-2.1,
+ AFL-3.0,
+ AGPL-3.0-only,
+ AGPL-3.0-or-later,
+ Apache-1.1,
+ Apache-2.0,
+ APSL-2.0,
+ Artistic-2.0,
+ BlueOak-1.0.0,
+ BSD-2-Clause,
+ BSD-3-Clause-Clear,
+ BSD-3-Clause,
+ BSL-1.0,
+ CAL-1.0,
+ CC-BY-3.0,
+ CC-BY-4.0,
+ CC-BY-SA-4.0,
+ CDDL-1.0,
+ CC0-1.0,
+ EPL-2.0,
+ GPL-2.0-only,
+ GPL-2.0-or-later,
+ GPL-2.0,
+ GPL-3.0-or-later,
+ ISC,
+ LGPL-2.0-only,
+ LGPL-2.1-only,
+ LGPL-2.1-or-later,
+ LGPL-2.1,
+ LGPL-3.0-only,
+ LGPL-3.0,
+ MIT,
+ MPL-2.0,
+ OFL-1.1,
+ PSF-2.0,
+ Python-2.0,
+ Python-2.0.1,
+ Unicode-DFS-2016,
+ Unlicense
diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml
index 0223101a0dc..673cb200b5e 100644
--- a/.github/workflows/test.yml
+++ b/.github/workflows/test.yml
@@ -1,129 +1,191 @@
-name: Test
-
-# cspell:word Ignus
-# cspell:word eslintcache
+name: Github Actions
on:
push:
branches:
- - master
+ - main
- dev-1
pull_request:
branches:
- - master
+ - main
- dev-1
+permissions:
+ contents: read
+
jobs:
lint:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Use Node.js
- uses: actions/setup-node@v1
- with:
- node-version: 14.x
- - id: yarn-cache-dir-path
- run: echo "::set-output name=dir::$(yarn cache dir)"
- - uses: actions/cache@v1
+ uses: actions/setup-node@v4
with:
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- restore-keys: ${{ runner.os }}-yarn-
+ node-version: lts/*
+ cache: "yarn"
- run: yarn --frozen-lockfile
- - uses: actions/cache@v1
+ - name: Cache prettier result
+ uses: actions/cache@v4
+ with:
+ path: ./node_modules/.cache/prettier/.prettier-cache
+ key: lint-prettier-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/.prettierrc.js') }}
+ restore-keys: lint-prettier-
+ - name: Cache eslint result
+ uses: actions/cache@v4
with:
path: .eslintcache
- key: lint-${{ env.GITHUB_SHA }}
- restore-keys: lint-
+ key: lint-eslint-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/eslint.config.js') }}
+ restore-keys: lint-eslint-
+ - name: Cache cspell result
+ uses: actions/cache@v4
+ with:
+ path: .cspellcache
+ key: lint-cspell-${{ runner.os }}-node-${{ hashFiles('**/yarn.lock', '**/cspell.json') }}
+ restore-keys: lint-cspell-
- run: yarn lint
basic:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Use Node.js
- uses: actions/setup-node@v1
+ uses: actions/setup-node@v4
with:
- node-version: 14.x
- - id: yarn-cache-dir-path
- run: echo "::set-output name=dir::$(yarn cache dir)"
- - uses: actions/cache@v1
- with:
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- restore-keys: ${{ runner.os }}-yarn-
+ node-version: lts/*
+ cache: "yarn"
- run: yarn --frozen-lockfile
- run: yarn link --frozen-lockfile || true
- run: yarn link webpack --frozen-lockfile
- - run: yarn test:basic --ci --reporters=default --reporters=jest-junit
- - uses: codecov/codecov-action@v1
+ - run: yarn test:basic --ci
+ - uses: codecov/codecov-action@v4
with:
flags: basic
functionalities: gcov
- unit:
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
+ validate-legacy-node:
runs-on: ubuntu-latest
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
- name: Use Node.js
- uses: actions/setup-node@v1
+ uses: actions/setup-node@v4
with:
- node-version: 14.x
- - id: yarn-cache-dir-path
- run: echo "::set-output name=dir::$(yarn cache dir)"
- - uses: actions/cache@v1
+ node-version: 10.x
+ cache: "yarn"
+ # Remove `devDependencies` from `package.json` to avoid `yarn install` compatibility error
+ - run: node -e "const content = require('./package.json');delete content.devDependencies;require('fs').writeFileSync('package.json', JSON.stringify(content, null, 2));"
+ - run: yarn install --production --frozen-lockfile
+ unit:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v4
+ - name: Use Node.js
+ uses: actions/setup-node@v4
with:
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- restore-keys: ${{ runner.os }}-yarn-
+ node-version: lts/*
+ cache: "yarn"
- run: yarn --frozen-lockfile
- run: yarn link --frozen-lockfile || true
- run: yarn link webpack --frozen-lockfile
- - uses: actions/cache@v1
+ - uses: actions/cache@v4
with:
path: .jest-cache
key: jest-unit-${{ env.GITHUB_SHA }}
- restore-keys: jest-unit-
- - run: yarn cover:unit --ci --cacheDirectory .jest-cache --reporters=default --reporters=jest-junit
- - uses: codecov/codecov-action@v1
+ restore-keys: jest-unit-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}
+ - run: yarn cover:unit --ci --cacheDirectory .jest-cache
+ - uses: codecov/codecov-action@v4
with:
flags: unit
functionalities: gcov
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
integration:
needs: basic
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
- node-version: [10.x, 14.x]
+ node-version: [10.x, 20.x]
+ part: [a, b]
include:
+ # Test with main branches of webpack dependencies
+ - os: ubuntu-latest
+ node-version: lts/*
+ part: a
+ use_main_branches: 1
+ - os: ubuntu-latest
+ node-version: lts/*
+ part: b
+ use_main_branches: 1
+ # Test on the latest version of Node.js
+ - os: ubuntu-latest
+ node-version: 22.x
+ part: a
+ - os: ubuntu-latest
+ node-version: 22.x
+ part: b
+ # Test on the old LTS version of Node.js
- os: ubuntu-latest
- node-version: 15.x
+ node-version: 18.x
+ part: a
+ - os: ubuntu-latest
+ node-version: 18.x
+ part: b
+ # Test on old Node.js versions
+ - os: ubuntu-latest
+ node-version: 16.x
+ part: a
+ - os: ubuntu-latest
+ node-version: 14.x
+ part: a
- os: ubuntu-latest
node-version: 12.x
+ part: a
runs-on: ${{ matrix.os }}
steps:
- - uses: actions/checkout@v2
+ - uses: actions/checkout@v4
+ - uses: actions/github-script@v7
+ id: calculate_architecture
+ with:
+ result-encoding: string
+ script: |
+ if ('${{ matrix.os }}' === 'macos-latest' && '${{ matrix['node-version'] }}' === '10.x') {
+ return "x64"
+ } else {
+ return ''
+ }
- name: Use Node.js ${{ matrix.node-version }}
- uses: actions/setup-node@v1
+ uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- - id: yarn-cache-dir-path
- run: echo "::set-output name=dir::$(yarn cache dir)"
- - uses: actions/cache@v1
- with:
- path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
- key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
- restore-keys: ${{ runner.os }}-yarn-
+ architecture: ${{ steps.calculate_architecture.outputs.result }}
+ cache: "yarn"
+ # Install old `jest` version and deps for legacy node versions
+ - run: |
+ yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines
+ yarn --frozen-lockfile --ignore-engines
+ if: matrix.node-version == '10.x' || matrix.node-version == '12.x' || matrix.node-version == '14.x'
+ - run: |
+ yarn upgrade husky@^8.0.3 lint-staged@^13.2.1 nyc@^15.1.0 coffee-loader@1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines
+ yarn --frozen-lockfile
+ if: matrix.node-version == '16.x'
+ # Install main version of our deps
+ - run: yarn upgrade enhanced-resolve@webpack/enhanced-resolve#main loader-runner@webpack/loader-runner#main webpack-sources@webpack/webpack-sources#main watchpack@webpack/watchpack#main tapable@webpack/tapable#master
+ if: matrix.use_main_branches == '1'
+ # Install dependencies for LTS node versions
- run: yarn --frozen-lockfile
+ if: matrix.node-version != '10.x' && matrix.node-version != '12.x' && matrix.node-version != '14.x' && matrix.node-version != '16.x'
- run: yarn link --frozen-lockfile || true
- run: yarn link webpack --frozen-lockfile
- - uses: actions/cache@v1
+ - uses: actions/cache@v4
with:
path: .jest-cache
key: jest-integration-${{ env.GITHUB_SHA }}
- restore-keys: jest-integration-
- - run: yarn cover:integration --ci --cacheDirectory .jest-cache --reporters=default --reporters=jest-junit
- - if: ${{ matrix.os != 'windows-latest' }}
- uses: codecov/codecov-action@v1
+ restore-keys: jest-integration-${{ hashFiles('**/yarn.lock', '**/jest.config.js') }}
+ - run: yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache || yarn cover:integration:${{ matrix.part }} --ci --cacheDirectory .jest-cache -f
+ - run: yarn cover:merge
+ - uses: codecov/codecov-action@v4
with:
flags: integration
functionalities: gcov
+ env:
+ CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
diff --git a/.gitignore b/.gitignore
index 4719028a0ea..8ae0b40e9dc 100644
--- a/.gitignore
+++ b/.gitignore
@@ -4,14 +4,20 @@
/test/fixtures/temp-*
/test/temp
/test/ChangesAndRemovals
+/test/**/dev-defaults.webpack.lock
/benchmark/js
/benchmark/fixtures
/examples/**/dist
+/assembly/**/*.wat
+/assembly/**/*.wasm
/coverage
+/.nyc_output
+/.jest-cache
.DS_Store
*.log
.idea
.vscode
.cache
.eslintcache
+.cspellcache
package-lock.json
diff --git a/.husky/.gitignore b/.husky/.gitignore
deleted file mode 100644
index 31354ec1389..00000000000
--- a/.husky/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-_
diff --git a/.husky/pre-commit b/.husky/pre-commit
index d37daa075e2..041c660c92b 100755
--- a/.husky/pre-commit
+++ b/.husky/pre-commit
@@ -1,4 +1 @@
-#!/bin/sh
-. "$(dirname "$0")/_/husky.sh"
-
npx --no-install lint-staged
diff --git a/.prettierignore b/.prettierignore
index dceadd34a1f..eeb72ea7218 100644
--- a/.prettierignore
+++ b/.prettierignore
@@ -1,11 +1,33 @@
package.json
-# Ignore test fixtures
-test/*.*
+# Ignore some test files
+test/**/*.*
!test/*.js
!test/**/webpack.config.js
+!test/**/test.config.js
+!test/**/test.filter.js
+!test/**/errors.js
+!test/**/warnings.js
!test/**/deprecations.js
+!test/*.md
+!test/helpers/*.*
+
+# Ignore some folders
+benchmark/
+coverage/
+
+# Ignore generated files
+*.check.js
+
+# Ignore not supported files
+*.d.ts
+!module.d.ts
+
+# Ignore precompiled schemas
+schemas/**/*.check.js
# Ignore example fixtures
-examples/*.*
+examples/
!examples/**/webpack.config.js
+
+.vscode/**/*.*
diff --git a/.travis.yml b/.travis.yml
deleted file mode 100644
index 409ddaf9503..00000000000
--- a/.travis.yml
+++ /dev/null
@@ -1,74 +0,0 @@
-dist: trusty
-language: node_js
-
-branches:
- only:
- - webpack-4
- - master
- - next
- - dev-1
-
-cache:
- yarn: true
- directories:
- - ".jest-cache"
- - ".eslintcache"
-
-stages:
- - basic
- - advanced
-
-matrix:
- include:
- - os: linux
- node_js: "12"
- env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=basic
- stage: basic
- - os: linux
- node_js: "12"
- env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=lintunit
- stage: advanced
- - os: linux
- node_js: "12"
- env: NO_WATCH_TESTS=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration
- stage: advanced
- - os: linux
- node_js: "12"
- env: NO_WATCH_TESTS=1 ALTERNATIVE_SORT=1 JEST="--maxWorkers=2 --cacheDirectory .jest-cache" JOB_PART=integration
- stage: advanced
- - os: linux
- node_js: "10"
- env:
- - NODEJS_VERSION=v15.0.0-nightly2020082003293aa3a1
- - YARN_EXTRA_ARGS="--ignore-engines"
- - NO_WATCH_TESTS=1
- - JEST="--maxWorkers=2 --cacheDirectory .jest-cache"
- - JOB_PART=integration
- stage: advanced
- fast_finish: true
-
-before_install:
- - |
- if [ "$NODEJS_VERSION" != "" ];
- then
- mkdir /opt/node
- curl --silent "https://nodejs.org/download/nightly/$NODEJS_VERSION/node-$NODEJS_VERSION-linux-x64.tar.gz" | tar -zxf - --directory /opt/node
- export PATH="/opt/node/node-$NODEJS_VERSION-linux-x64/bin:$PATH"
- node --version
- fi
-
-install:
- - yarn --frozen-lockfile $YARN_EXTRA_ARGS
- - yarn link --frozen-lockfile $YARN_EXTRA_ARGS || true
- - yarn link webpack --frozen-lockfile $YARN_EXTRA_ARGS
-
-script: yarn travis:$JOB_PART
-
-after_success:
- - cat ./coverage/lcov.info | node_modules/.bin/coveralls --verbose
- - bash <(curl -s https://codecov.io/bash) -F $JOB_PART -X gcov
- - rm -f .jest-cache/haste-map* .jest-cache/perf-cache*
-
-notifications:
- slack:
- secure: JduSdKWwbnLCwo7Z4E59SGE+Uw832UwnXzQiKEpg1BV45MYDPRiGltly1tRHmPh9OGjvGx3XSkC2tNGOBLtL4UL2SCkf012x0t7jDutKRfcv/njynl8jk8l+UhPmaWiHXDQAgGiiKdL4RfzPLW3HeVHCOWm0LKMzcarTa8tw+rE=
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
index 146a567a0c0..700cae8fab1 100644
--- a/CONTRIBUTING.md
+++ b/CONTRIBUTING.md
@@ -55,6 +55,18 @@ greatly appreciate any time spent fixing typos or clarifying sections in the
documentation. [See a list of issues with the documentation tag](https://github.com/webpack/webpack/labels/documentation),
or [check out the issues on the documentation website's repository](https://github.com/webpack/webpack.js.org/issues).
+## Types
+
+webpack is statically typed using JSDoc annotation and TypeScript. If you would like to export a new type which doesn't belong to a public API, then you can do so by declaring it in `webpack/lib/index.js`.
+
+`webpack/lib/index.js`
+
+```js
+/** @typedef {import("./NormalModuleFactory").ResolveData} ResolveData */
+```
+
+Then, automatically generate the type declarations by running `yarn fix` locally, and the changes you have made will be reflected in `types.d.ts`.
+
## Discussions
Gitter is only for small questions. To discuss a subject in detail, please send a link to your forum or blog in the Gitter chat.
diff --git a/README.md b/README.md
index 5f993035bd2..e26e3b2782f 100644
--- a/README.md
+++ b/README.md
@@ -8,17 +8,15 @@
[![npm][npm]][npm-url]
[![node][node]][node-url]
-[![deps][deps]][deps-url]
-[![tests][tests]][tests-url]
-[![builds][builds]][builds-url]
+[![builds1][builds1]][builds1-url]
[![builds2][builds2]][builds2-url]
+[![dependency-review][dependency-review]][dependency-review-url]
[![coverage][cover]][cover-url]
-[![licenses][licenses]][licenses-url]
[![PR's welcome][prs]][prs-url]
-
-
+
+
@@ -35,12 +33,18 @@
-
-
+
+
+
+
+
+
+
+
webpack
- webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.
+ Webpack is a module bundler. Its main purpose is to bundle JavaScript files for usage in a browser, yet it is also capable of transforming, bundling, or packaging just about any resource or asset.
@@ -77,7 +81,7 @@ yarn add webpack --dev
Introduction
-webpack is a bundler for modules. The main purpose is to bundle JavaScript
+Webpack is a bundler for modules. The main purpose is to bundle JavaScript
files for usage in a browser, yet it is also capable of transforming, bundling,
or packaging just about any resource or asset.
@@ -95,14 +99,14 @@ Check out webpack's quick [**Get Started**](https://webpack.js.org/guides/gettin
### Browser Compatibility
-webpack supports all browsers that are [ES5-compliant](https://kangax.github.io/compat-table/es5/) (IE8 and below are not supported).
-webpack also needs `Promise` for `import()` and `require.ensure()`. If you want to support older browsers, you will need to [load a polyfill](https://webpack.js.org/guides/shimming/) before using these expressions.
+Webpack supports all browsers that are [ES5-compliant](https://kangax.github.io/compat-table/es5/) (IE8 and below are not supported).
+Webpack also needs `Promise` for `import()` and `require.ensure()`. If you want to support older browsers, you will need to [load a polyfill](https://webpack.js.org/guides/shimming/) before using these expressions.
Concepts
### [Plugins](https://webpack.js.org/plugins/)
-webpack has a [rich plugin
+Webpack has a [rich plugin
interface](https://webpack.js.org/plugins/). Most of the features
within webpack itself use this plugin interface. This makes webpack very
**flexible**.
@@ -112,6 +116,7 @@ within webpack itself use this plugin interface. This makes webpack very
| [mini-css-extract-plugin][mini-css] | ![mini-css-npm] | ![mini-css-size] | Extracts CSS into separate files. It creates a CSS file per JS file which contains CSS. |
| [compression-webpack-plugin][compression] | ![compression-npm] | ![compression-size] | Prepares compressed versions of assets to serve them with Content-Encoding |
| [html-webpack-plugin][html-plugin] | ![html-plugin-npm] | ![html-plugin-size] | Simplifies creation of HTML files (`index.html`) to serve your bundles |
+| [pug-plugin][pug-plugin] | ![pug-plugin-npm] | ![pug-plugin-size] | Renders Pug files to HTML, extracts JS and CSS from sources specified directly in Pug. |
[common-npm]: https://img.shields.io/npm/v/webpack.svg
[mini-css]: https://github.com/webpack-contrib/mini-css-extract-plugin
@@ -126,10 +131,13 @@ within webpack itself use this plugin interface. This makes webpack very
[html-plugin]: https://github.com/jantimon/html-webpack-plugin
[html-plugin-npm]: https://img.shields.io/npm/v/html-webpack-plugin.svg
[html-plugin-size]: https://packagephobia.com/badge?p=html-webpack-plugin
+[pug-plugin]: https://github.com/webdiscus/pug-plugin
+[pug-plugin-npm]: https://img.shields.io/npm/v/pug-plugin.svg
+[pug-plugin-size]: https://packagephobia.com/badge?p=pug-plugin
### [Loaders](https://webpack.js.org/loaders/)
-webpack enables the use of loaders to preprocess files. This allows you to bundle
+Webpack enables the use of loaders to preprocess files. This allows you to bundle
**any static resource** way beyond JavaScript. You can easily [write your own
loaders](https://webpack.js.org/api/loaders/) using Node.js.
@@ -138,25 +146,13 @@ or are automatically applied via regex from your webpack configuration.
#### Files
-| Name | Status | Install Size | Description |
-| :-----------------: | :---------: | :----------: | :---------------------------------------------------------------------------------------- |
-| [raw-loader][raw] | ![raw-npm] | ![raw-size] | Loads raw content of a file (utf-8) |
-| [val-loader][val] | ![val-npm] | ![val-size] | Executes code as module and considers exports as JS code |
-| [url-loader][url] | ![url-npm] | ![url-size] | Works like the file loader, but can return a Data Url if the file is smaller than a limit |
-| [file-loader][file] | ![file-npm] | ![file-size] | Emits the file into the output folder and returns the (relative) url |
+| Name | Status | Install Size | Description |
+| :---------------: | :--------: | :----------: | :------------------------------------------------------- |
+| [val-loader][val] | ![val-npm] | ![val-size] | Executes code as module and considers exports as JS code |
-[raw]: https://github.com/webpack-contrib/raw-loader
-[raw-npm]: https://img.shields.io/npm/v/raw-loader.svg
-[raw-size]: https://packagephobia.com/badge?p=raw-loader
[val]: https://github.com/webpack-contrib/val-loader
[val-npm]: https://img.shields.io/npm/v/val-loader.svg
[val-size]: https://packagephobia.com/badge?p=val-loader
-[url]: https://github.com/webpack-contrib/url-loader
-[url-npm]: https://img.shields.io/npm/v/url-loader.svg
-[url-size]: https://packagephobia.com/badge?p=url-loader
-[file]: https://github.com/webpack-contrib/file-loader
-[file-npm]: https://img.shields.io/npm/v/file-loader.svg
-[file-size]: https://packagephobia.com/badge?p=file-loader
#### JSON
@@ -169,17 +165,14 @@ or are automatically applied via regex from your webpack configuration.
#### Transpiling
-| Name | Status | Install Size | Description |
-| :--------------------------------------------------------------------------------------------------------------------------------------------------------: | :------------: | :-------------: | :--------------------------------------------------------------------------------------------------- |
-| | ![babel-npm] | ![babel-size] | Loads ES2015+ code and transpiles to ES5 using Babel |
-| | ![traceur-npm] | ![traceur-size] | Loads ES2015+ code and transpiles to ES5 using [Traceur](https://github.com/google/traceur-compiler) |
-| | ![type-npm] | ![type-size] | Loads TypeScript like JavaScript |
-| | ![coffee-npm] | ![coffee-size] | Loads CoffeeScript like JavaScript |
+| Name | Status | Install Size | Description |
+| :----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-----------: | :------------: | :------------------------------------------------------------------------------------------------ |
+| | ![babel-npm] | ![babel-size] | Loads ES2015+ code and transpiles to ES5 using Babel |
+| | ![type-npm] | ![type-size] | Loads TypeScript like JavaScript |
+| | ![coffee-npm] | ![coffee-size] | Loads CoffeeScript like JavaScript |
[babel-npm]: https://img.shields.io/npm/v/babel-loader.svg
[babel-size]: https://packagephobia.com/badge?p=babel-loader
-[traceur-npm]: https://img.shields.io/npm/v/traceur-loader.svg
-[traceur-size]: https://packagephobia.com/badge?p=traceur-loader
[coffee-npm]: https://img.shields.io/npm/v/coffee-loader.svg
[coffee-size]: https://packagephobia.com/badge?p=coffee-loader
[type-npm]: https://img.shields.io/npm/v/ts-loader.svg
@@ -187,18 +180,21 @@ or are automatically applied via regex from your webpack configuration.
#### Templating
-| Name | Status | Install Size | Description |
-| :-------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------: | :--------------: | :-------------------------------------------------------------------------------------- |
-| | ![html-npm] | ![html-size] | Exports HTML as string, requires references to static resources |
-| | ![pug-npm] | ![pug-size] | Loads Pug templates and returns a function |
-| | ![md-npm] | ![md-size] | Compiles Markdown to HTML |
-| | ![posthtml-npm] | ![posthtml-size] | Loads and transforms a HTML file using [PostHTML](https://github.com/posthtml/posthtml) |
-| | ![hbs-npm] | ![hbs-size] | Compiles Handlebars to HTML |
+| Name | Status | Install Size | Description |
+| :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------: | :--------------: | :-------------------------------------------------------------------------------------- |
+| | ![html-npm] | ![html-size] | Exports HTML as string, requires references to static resources |
+| | ![pug-npm] | ![pug-size] | Loads Pug templates and returns a function |
+| | ![pug3-npm] | ![pug3-size] | Compiles Pug to a function or HTML string, useful for use with Vue, React, Angular |
+| | ![md-npm] | ![md-size] | Compiles Markdown to HTML |
+| | ![posthtml-npm] | ![posthtml-size] | Loads and transforms a HTML file using [PostHTML](https://github.com/posthtml/posthtml) |
+| | ![hbs-npm] | ![hbs-size] | Compiles Handlebars to HTML |
[html-npm]: https://img.shields.io/npm/v/html-loader.svg
[html-size]: https://packagephobia.com/badge?p=html-loader
[pug-npm]: https://img.shields.io/npm/v/pug-loader.svg
[pug-size]: https://packagephobia.com/badge?p=pug-loader
+[pug3-npm]: https://img.shields.io/npm/v/@webdiscus/pug-loader.svg
+[pug3-size]: https://packagephobia.com/badge?p=@webdiscus/pug-loader
[jade-npm]: https://img.shields.io/npm/v/jade-loader.svg
[jade-size]: https://packagephobia.com/badge?p=jade-loader
[md-npm]: https://img.shields.io/npm/v/markdown-loader.svg
@@ -240,6 +236,7 @@ or are automatically applied via regex from your webpack configuration.
| | ![polymer-npm] | ![polymer-size] | Process HTML & CSS with preprocessor of choice and `require()` Web Components like first-class modules |
| | ![angular-npm] | ![angular-size] | Loads and compiles Angular 2 Components |
| | ![riot-npm] | ![riot-size] | Riot official webpack loader |
+| | ![svelte-npm] | ![svelte-size] | Official Svelte loader |
[vue-npm]: https://img.shields.io/npm/v/vue-loader.svg
[vue-size]: https://packagephobia.com/badge?p=vue-loader
@@ -249,26 +246,28 @@ or are automatically applied via regex from your webpack configuration.
[angular-size]: https://packagephobia.com/badge?p=angular2-template-loader
[riot-npm]: https://img.shields.io/npm/v/riot-tag-loader.svg
[riot-size]: https://packagephobia.com/badge?p=riot-tag-loader
+[svelte-npm]: https://img.shields.io/npm/v/svelte-loader.svg
+[svelte-size]: https://packagephobia.com/badge?p=svelte-loader
### Performance
-webpack uses async I/O and has multiple caching levels. This makes webpack fast
+Webpack uses async I/O and has multiple caching levels. This makes webpack fast
and incredibly **fast** on incremental compilations.
### Module Formats
-webpack supports ES2015+, CommonJS and AMD modules **out of the box**. It performs clever static
+Webpack supports ES2015+, CommonJS and AMD modules **out of the box**. It performs clever static
analysis on the AST of your code. It even has an evaluation engine to evaluate
simple expressions. This allows you to **support most existing libraries** out of the box.
### [Code Splitting](https://webpack.js.org/guides/code-splitting/)
-webpack allows you to split your codebase into multiple chunks. Chunks are
+Webpack allows you to split your codebase into multiple chunks. Chunks are
loaded asynchronously at runtime. This reduces the initial loading time.
### [Optimizations](https://webpack.js.org/guides/production-build/)
-webpack can do many optimizations to **reduce the output size of your
+Webpack can do many optimizations to **reduce the output size of your
JavaScript** by deduplicating frequently used modules, minifying, and giving
you full control of what is loaded initially and what is loaded at runtime
through code splitting. It can also make your code chunks **cache
@@ -290,7 +289,7 @@ Contributions go far beyond pull requests and commits. Although we love giving y
- [Blogging, speaking about, or creating tutorials](https://github.com/webpack-contrib/awesome-webpack) about one of webpack's many features.
- Helping others in our webpack [gitter channel](https://gitter.im/webpack/webpack).
-To get started have a look at our [documentation on contributing](https://github.com/webpack/webpack/blob/master/CONTRIBUTING.md).
+To get started have a look at our [documentation on contributing](https://github.com/webpack/webpack/blob/main/CONTRIBUTING.md).
If you are worried or don't know where to start, you can **always** reach out to [Sean Larkin (@TheLarkInn) on Twitter](https://twitter.com/thelarkinn) or simply submit an issue and a maintainer can help give you guidance!
@@ -317,7 +316,7 @@ a question to [StackOverflow with the webpack tag](https://stackoverflow.com/tag
If you are twitter savvy you can tweet #webpack with your question and someone should be able to reach out and help also.
-If you have discovered a ๐ or have a feature suggestion, feel free to create an issue on Github.
+If you have discovered a ๐ or have a feature suggestion, feel free to create an issue on GitHub.
### License
@@ -407,7 +406,7 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI">
Gold Sponsors
-[Become a gold sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on Github with a link to your site.
+[Become a gold sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on GitHub with a link to your site.
@@ -446,7 +445,7 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI">
Silver Sponsors
-[Become a silver sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on Github with a link to your site.
+[Become a silver sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on GitHub with a link to your site.
@@ -485,7 +484,7 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI">
Bronze Sponsors
-[Become a bronze sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on Github with a link to your site.
+[Become a bronze sponsor](https://opencollective.com/webpack#sponsor) and get your logo on our README on GitHub with a link to your site.
@@ -595,7 +594,7 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI">
Backers
-[Become a backer](https://opencollective.com/webpack#backer) and get your image on our README on Github with a link to your site.
+[Become a backer](https://opencollective.com/webpack#backer) and get your image on our README on GitHub with a link to your site.
@@ -704,7 +703,7 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI">
- [@google](https://github.com/google) for [Google Web Toolkit (GWT)](http://www.gwtproject.org/), which aims to compile Java to JavaScript. It features a similar [Code Splitting](http://www.gwtproject.org/doc/latest/DevGuideCodeSplitting.html) as webpack.
- [@medikoo](https://github.com/medikoo) for [modules-webmake](https://github.com/medikoo/modules-webmake), which is a similar project. webpack was born because I wanted Code Splitting for modules-webmake. Interestingly the [Code Splitting issue is still open](https://github.com/medikoo/modules-webmake/issues/7) (thanks also to @Phoscur for the discussion).
-- [@substack](https://github.com/substack) for [browserify](http://browserify.org/), which is a similar project and source for many ideas.
+- [@substack](https://github.com/substack) for [browserify](https://browserify.org/), which is a similar project and source for many ideas.
- [@jrburke](https://github.com/jrburke) for [require.js](https://requirejs.org/), which is a similar project and source for many ideas.
- [@defunctzombie](https://github.com/defunctzombie) for the [browser-field spec](https://github.com/defunctzombie/package-browser-field-spec), which makes modules available for node.js, browserify and webpack.
- Every early webpack user, which contributed to webpack by writing issues or PRs. You influenced the direction...
@@ -716,17 +715,13 @@ src="https://static.monei.net/monei-logo.svg" height="30" alt="MONEI">
[npm-url]: https://npmjs.com/package/webpack
[node]: https://img.shields.io/node/v/webpack.svg
[node-url]: https://nodejs.org
-[deps]: https://img.shields.io/david/webpack/webpack.svg
-[deps-url]: https://david-dm.org/webpack/webpack
-[tests]: https://img.shields.io/travis/webpack/webpack/master.svg
-[tests-url]: https://travis-ci.org/webpack/webpack
[prs]: https://img.shields.io/badge/PRs-welcome-brightgreen.svg
[prs-url]: https://webpack.js.org/contribute/
-[builds-url]: https://ci.appveyor.com/project/sokra/webpack/branch/master
-[builds]: https://ci.appveyor.com/api/projects/status/github/webpack/webpack?svg=true
-[builds2]: https://dev.azure.com/webpack/webpack/_apis/build/status/webpack.webpack
-[builds2-url]: https://dev.azure.com/webpack/webpack/_build/latest?definitionId=3
-[licenses-url]: https://app.fossa.io/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack?ref=badge_shield
-[licenses]: https://app.fossa.io/api/projects/git%2Bhttps%3A%2F%2Fgithub.com%2Fwebpack%2Fwebpack.svg?type=shield
-[cover]: https://img.shields.io/coveralls/webpack/webpack.svg
-[cover-url]: https://coveralls.io/r/webpack/webpack/
+[builds1]: https://github.com/webpack/webpack/actions/workflows/test.yml/badge.svg
+[builds1-url]: https://github.com/webpack/webpack/actions/workflows/test.yml
+[builds2]: https://dev.azure.com/webpack/webpack/_apis/build/status%2Fwebpack.webpack?branchName=main
+[builds2-url]: https://dev.azure.com/webpack/webpack/_build/latest?definitionId=3&branchName=main
+[dependency-review-url]: https://github.com/webpack/webpack/actions/workflows/dependency-review.yml
+[dependency-review]: https://github.com/webpack/webpack/actions/workflows/dependency-review.yml/badge.svg
+[cover]: https://codecov.io/gh/webpack/webpack/branch/master/graph/badge.svg?token=mDP3mQJNnn
+[cover-url]: https://codecov.io/gh/webpack/webpack
diff --git a/appveyor.yml b/appveyor.yml
deleted file mode 100644
index dc77d985d68..00000000000
--- a/appveyor.yml
+++ /dev/null
@@ -1,37 +0,0 @@
-# appveyor file
-# http://www.appveyor.com/docs/appveyor-yml
-
-branches:
- only:
- - webpack-4
- - master
- - next
- - dev-1
-
-init:
- - git config --global core.autocrlf input
-
-cache:
- - "..\\.yarn-cache"
- - ".jest-cache"
-
-install:
- - ps: Install-Product node 14 x64
- - yarn --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache
- - yarn link --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache || yarn link --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache
- - yarn link webpack --frozen-lockfile --preferred-cache-folder ..\\.yarn-cache
-
-build: off
-
-matrix:
- fast_finish: true
-
-test_script:
- - node --version
- - yarn --version
- - cmd: set JEST=--maxWorkers=2 --cacheDirectory .jest-cache
- - cmd: yarn appveyor:integration
- - cmd: yarn istanbul report --report lcovonly
- - cmd: yarn unlink webpack
- - cmd: yarn global add codecov && codecov -F integration --disable=gcov
- - cmd: del /F /Q .jest-cache\\haste-map* .jest-cache\\perf-cache* 2> null || Ver > null
diff --git a/assembly/hash/md4.asm.ts b/assembly/hash/md4.asm.ts
new file mode 100644
index 00000000000..3388ecc57e9
--- /dev/null
+++ b/assembly/hash/md4.asm.ts
@@ -0,0 +1,177 @@
+/*
+ ** ********************************************************************
+ ** md4.c -- Implementation of MD4 Message Digest Algorithm **
+ ** Updated: 2/16/90 by Ronald L. Rivest **
+ ** (C) 1990 RSA Data Security, Inc. **
+ ** ********************************************************************
+ */
+
+// Ported to assemblyscript by Tobias Koppers
+
+let totalLength: u32;
+let A: u32;
+let B: u32;
+let C: u32;
+let D: u32;
+
+function F(x: u32, y: u32, z: u32): u32 {
+ return z ^ (x & (y ^ z));
+}
+function G(x: u32, y: u32, z: u32): u32 {
+ return (x & (y | z)) | (y & z);
+}
+function H(x: u32, y: u32, z: u32): u32 {
+ return x ^ y ^ z;
+}
+
+function roundF(a: u32, b: u32, c: u32, d: u32, i: u32, s: u32): u32 {
+ return rotl
(a + F(b, c, d) + load(i), s);
+}
+function roundG(a: u32, b: u32, c: u32, d: u32, i: u32, s: u32): u32 {
+ return rotl(a + G(b, c, d) + load(i) + 0x5a827999, s);
+}
+function roundH(a: u32, b: u32, c: u32, d: u32, i: u32, s: u32): u32 {
+ return rotl(a + H(b, c, d) + load(i) + 0x6ed9eba1, s);
+}
+
+export function init(): void {
+ A = 0x67452301;
+ B = 0xefcdab89;
+ C = 0x98badcfe;
+ D = 0x10325476;
+ totalLength = 0;
+}
+
+function body(size: u32): void {
+ let _A = A;
+ let _B = B;
+ let _C = C;
+ let _D = D;
+
+ for (let i: u32 = 0; i < size; i += 64) {
+ let a = _A;
+ let b = _B;
+ let c = _C;
+ let d = _D;
+
+ // Round F
+
+ a = roundF(a, b, c, d, i + 4 * 0, 3);
+ d = roundF(d, a, b, c, i + 4 * 1, 7);
+ c = roundF(c, d, a, b, i + 4 * 2, 11);
+ b = roundF(b, c, d, a, i + 4 * 3, 19);
+
+ a = roundF(a, b, c, d, i + 4 * 4, 3);
+ d = roundF(d, a, b, c, i + 4 * 5, 7);
+ c = roundF(c, d, a, b, i + 4 * 6, 11);
+ b = roundF(b, c, d, a, i + 4 * 7, 19);
+
+ a = roundF(a, b, c, d, i + 4 * 8, 3);
+ d = roundF(d, a, b, c, i + 4 * 9, 7);
+ c = roundF(c, d, a, b, i + 4 * 10, 11);
+ b = roundF(b, c, d, a, i + 4 * 11, 19);
+
+ a = roundF(a, b, c, d, i + 4 * 12, 3);
+ d = roundF(d, a, b, c, i + 4 * 13, 7);
+ c = roundF(c, d, a, b, i + 4 * 14, 11);
+ b = roundF(b, c, d, a, i + 4 * 15, 19);
+
+ // Round G
+
+ a = roundG(a, b, c, d, i + 4 * 0, 3);
+ d = roundG(d, a, b, c, i + 4 * 4, 5);
+ c = roundG(c, d, a, b, i + 4 * 8, 9);
+ b = roundG(b, c, d, a, i + 4 * 12, 13);
+
+ a = roundG(a, b, c, d, i + 4 * 1, 3);
+ d = roundG(d, a, b, c, i + 4 * 5, 5);
+ c = roundG(c, d, a, b, i + 4 * 9, 9);
+ b = roundG(b, c, d, a, i + 4 * 13, 13);
+
+ a = roundG(a, b, c, d, i + 4 * 2, 3);
+ d = roundG(d, a, b, c, i + 4 * 6, 5);
+ c = roundG(c, d, a, b, i + 4 * 10, 9);
+ b = roundG(b, c, d, a, i + 4 * 14, 13);
+
+ a = roundG(a, b, c, d, i + 4 * 3, 3);
+ d = roundG(d, a, b, c, i + 4 * 7, 5);
+ c = roundG(c, d, a, b, i + 4 * 11, 9);
+ b = roundG(b, c, d, a, i + 4 * 15, 13);
+
+ // Round H
+
+ a = roundH(a, b, c, d, i + 4 * 0, 3);
+ d = roundH(d, a, b, c, i + 4 * 8, 9);
+ c = roundH(c, d, a, b, i + 4 * 4, 11);
+ b = roundH(b, c, d, a, i + 4 * 12, 15);
+
+ a = roundH(a, b, c, d, i + 4 * 2, 3);
+ d = roundH(d, a, b, c, i + 4 * 10, 9);
+ c = roundH(c, d, a, b, i + 4 * 6, 11);
+ b = roundH(b, c, d, a, i + 4 * 14, 15);
+
+ a = roundH(a, b, c, d, i + 4 * 1, 3);
+ d = roundH(d, a, b, c, i + 4 * 9, 9);
+ c = roundH(c, d, a, b, i + 4 * 5, 11);
+ b = roundH(b, c, d, a, i + 4 * 13, 15);
+
+ a = roundH(a, b, c, d, i + 4 * 3, 3);
+ d = roundH(d, a, b, c, i + 4 * 11, 9);
+ c = roundH(c, d, a, b, i + 4 * 7, 11);
+ b = roundH(b, c, d, a, i + 4 * 15, 15);
+
+ _A += a;
+ _B += b;
+ _C += c;
+ _D += d;
+ }
+
+ A = _A;
+ B = _B;
+ C = _C;
+ D = _D;
+}
+
+export function update(length: u32): void {
+ body(length);
+ totalLength += length;
+}
+
+export function final(length: u32): void {
+ const bits: u64 = u64(totalLength + length) << 3;
+ const finalLength: u32 = (length + 9 + 63) & ~63;
+ const bitsPosition = finalLength - 8;
+
+ // end
+ store(length++, 0x80);
+
+ // padding
+ for (; length & 7 && length < finalLength; length++) store(length, 0);
+ for (; length < finalLength; length += 8) store(length, 0);
+
+ // bits
+ store(bitsPosition, bits);
+
+ body(finalLength);
+
+ store(0, u32ToHex(A));
+ store(8, u32ToHex(B));
+ store(16, u32ToHex(C));
+ store(24, u32ToHex(D));
+}
+
+function u32ToHex(x: u64): u64 {
+ // from https://johnnylee-sde.github.io/Fast-unsigned-integer-to-hex-string/
+
+ x = ((x & 0xffff0000) << 16) | (x & 0xffff);
+ x = ((x & 0x0000ff000000ff00) << 8) | (x & 0x000000ff000000ff);
+ x = ((x & 0x00f000f000f000f0) >> 4) | ((x & 0x000f000f000f000f) << 8);
+
+ const mask = ((x + 0x0606060606060606) >> 4) & 0x0101010101010101;
+
+ x |= 0x3030303030303030;
+
+ x += 0x27 * mask;
+
+ return x;
+}
diff --git a/assembly/hash/xxhash64.asm.ts b/assembly/hash/xxhash64.asm.ts
new file mode 100644
index 00000000000..7f6b9df43f9
--- /dev/null
+++ b/assembly/hash/xxhash64.asm.ts
@@ -0,0 +1,129 @@
+// //////////////////////////////////////////////////////////
+// xxhash64.h
+// Copyright (c) 2016 Stephan Brumme. All rights reserved.
+// see http://create.stephan-brumme.com/disclaimer.html
+//
+// XXHash (64 bit), based on Yann Collet's descriptions, see
+// http://cyan4973.github.io/xxHash/
+//
+// Modified for hash-wasm by Dani Birรณ
+//
+// Ported to assemblyscript by Tobias Koppers
+// Modifications:
+// - seed is always 0
+// - update is only called with a multiple of 32
+// - final takes the remaining 0 - 31 bytes
+//
+
+const Prime1: u64 = 11400714785074694791;
+const Prime2: u64 = 14029467366897019727;
+const Prime3: u64 = 1609587929392839161;
+const Prime4: u64 = 9650029242287828579;
+const Prime5: u64 = 2870177450012600261;
+
+let state0: u64;
+let state1: u64;
+let state2: u64;
+let state3: u64;
+let totalLength: u64;
+
+function processSingle(previous: u64, input: u64): u64 {
+ return rotl(previous + input * Prime2, 31) * Prime1;
+}
+
+export function init(): void {
+ state0 = Prime1 + Prime2;
+ state1 = Prime2;
+ state2 = 0;
+ state3 = 0 - Prime1;
+ totalLength = 0;
+}
+
+export function update(length: u32): void {
+ if (length == 0) return;
+
+ totalLength += length;
+
+ let dataPtr: u32 = 0;
+
+ let s0 = state0;
+ let s1 = state1;
+ let s2 = state2;
+ let s3 = state3;
+
+ do {
+ s0 = processSingle(s0, load(dataPtr));
+ s1 = processSingle(s1, load(dataPtr + 8));
+ s2 = processSingle(s2, load(dataPtr + 16));
+ s3 = processSingle(s3, load(dataPtr + 24));
+ dataPtr += 32;
+ } while (dataPtr < length);
+
+ state0 = s0;
+ state1 = s1;
+ state2 = s2;
+ state3 = s3;
+}
+
+export function final(length: u32): void {
+ // fold 256 bit state into one single 64 bit value
+ let result: u64;
+ if (totalLength > 0) {
+ result =
+ rotl(state0, 1) + rotl(state1, 7) + rotl(state2, 12) + rotl(state3, 18);
+ result = (result ^ processSingle(0, state0)) * Prime1 + Prime4;
+ result = (result ^ processSingle(0, state1)) * Prime1 + Prime4;
+ result = (result ^ processSingle(0, state2)) * Prime1 + Prime4;
+ result = (result ^ processSingle(0, state3)) * Prime1 + Prime4;
+ } else {
+ result = Prime5;
+ }
+
+ result += totalLength + length;
+
+ let dataPtr: u32 = 0;
+
+ // at least 8 bytes left ? => eat 8 bytes per step
+ for (; dataPtr + 8 <= length; dataPtr += 8) {
+ result =
+ rotl(result ^ processSingle(0, load(dataPtr)), 27) * Prime1 + Prime4;
+ }
+
+ // 4 bytes left ? => eat those
+ if (dataPtr + 4 <= length) {
+ result = rotl(result ^ (load(dataPtr) * Prime1), 23) * Prime2 + Prime3;
+ dataPtr += 4;
+ }
+
+ // take care of remaining 0..3 bytes, eat 1 byte per step
+ while (dataPtr !== length) {
+ result = rotl(result ^ (load(dataPtr) * Prime5), 11) * Prime1;
+ dataPtr++;
+ }
+
+ // mix bits
+ result ^= result >> 33;
+ result *= Prime2;
+ result ^= result >> 29;
+ result *= Prime3;
+ result ^= result >> 32;
+
+ store(0, u32ToHex(result >> 32));
+ store(8, u32ToHex(result & 0xffffffff));
+}
+
+function u32ToHex(x: u64): u64 {
+ // from https://johnnylee-sde.github.io/Fast-unsigned-integer-to-hex-string/
+
+ x = ((x & 0xffff) << 32) | ((x & 0xffff0000) >> 16);
+ x = ((x & 0x0000ff000000ff00) >> 8) | ((x & 0x000000ff000000ff) << 16);
+ x = ((x & 0x00f000f000f000f0) >> 4) | ((x & 0x000f000f000f000f) << 8);
+
+ const mask = ((x + 0x0606060606060606) >> 4) & 0x0101010101010101;
+
+ x |= 0x3030303030303030;
+
+ x += 0x27 * mask;
+
+ return x;
+}
diff --git a/assembly/tsconfig.json b/assembly/tsconfig.json
new file mode 100644
index 00000000000..ec198544982
--- /dev/null
+++ b/assembly/tsconfig.json
@@ -0,0 +1,4 @@
+{
+ "extends": "assemblyscript/std/assembly.json",
+ "include": ["./**/*.asm.ts"]
+}
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index ec5901b8dd5..5c8fd1cfe7b 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -6,38 +6,34 @@ jobs:
pool:
vmImage: ubuntu-latest
steps:
- - task: NodeTool@0
+ - task: UseNode@1
inputs:
- versionSpec: "^14.0.0"
+ version: "18.x"
displayName: "Install Node.js"
- script: |
- curl -o- -L https://yarnpkg.com/install.sh | bash
- displayName: "Install Yarn"
- - script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v
yarn -v
displayName: "Print versions"
- - task: CacheBeta@1
+ - task: Cache@2
inputs:
- key: yarn | $(Agent.OS) | yarn.lock
+ key: 'yarn | "$(Agent.OS)" | yarn.lock'
+ restoreKeys: |
+ yarn | "$(Agent.OS)"
+ yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile
yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile
displayName: "Install dependencies"
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
export JEST_JUNIT_OUTPUT_NAME=basic-junit.xml
- yarn test:basic --ci --reporters=jest-junit
+ yarn test:basic --ci --reporters=default --reporters=jest-junit
export JEST_JUNIT_OUTPUT_NAME=unit-junit.xml
- yarn test:unit --ci --reporters=jest-junit
+ yarn test:unit --ci --reporters=default --reporters=jest-junit
+ env:
+ CI: "true"
displayName: "Run basic tests"
- task: PublishTestResults@2
inputs:
@@ -45,6 +41,9 @@ jobs:
testResultsFiles: "**/basic-junit.xml"
condition: succeededOrFailed()
displayName: "Publish basic test results"
+ - script: |
+ node -e "const fs = require('fs');let data = fs.readFileSync('unit-junit.xml', 'utf-8');fs.writeFileSync('unit-junit.xml', data.replace(/\0/g, 'NULL_CHARACTER'))"
+ displayName: "Fix junit output"
- task: PublishTestResults@2
inputs:
testRunTitle: "unit"
@@ -56,47 +55,32 @@ jobs:
pool:
vmImage: ubuntu-latest
steps:
- - task: NodeTool@0
+ - task: UseNode@1
inputs:
- versionSpec: "^14.0.0"
+ version: "18.x"
displayName: "Install Node.js"
- script: |
- curl -o- -L https://yarnpkg.com/install.sh | bash
- displayName: "Install Yarn"
- - script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v
yarn -v
displayName: "Print versions"
- - task: CacheBeta@1
+ - task: Cache@2
inputs:
- key: yarn | $(Agent.OS) | yarn.lock
+ key: 'yarn | "$(Agent.OS)" | yarn.lock'
+ restoreKeys: |
+ yarn | "$(Agent.OS)"
+ yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile
yarn link --frozen-lockfile || true
yarn link webpack --frozen-lockfile
displayName: "Install dependencies"
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
- yarn -s run code-lint --format junit > junit.xml
- yarn special-lint
- yarn type-lint
- yarn typings-lint
- yarn pretty-lint
- yarn spellcheck
+ yarn lint
+ env:
+ CI: "true"
displayName: "Run linting"
- - task: PublishTestResults@2
- inputs:
- testRunTitle: "lint"
- testResultsFiles: "**/junit.xml"
- condition: succeededOrFailed()
- displayName: "Publish lint results"
- job: Windows
dependsOn:
@@ -105,40 +89,63 @@ jobs:
pool:
vmImage: windows-latest
strategy:
- maxParallel: 3
+ maxParallel: 6
matrix:
- node-10:
- node_version: ^10.13.0
- node-12:
- node_version: ^12.4.0
- node-14:
- node_version: ^14.0.0
+ node-10-a:
+ node_version: 10.x
+ part: a
+ node-10-b:
+ node_version: 10.x
+ part: b
+ node-18-a:
+ node_version: 18.x
+ part: a
+ node-18-b:
+ node_version: 18.x
+ part: b
+ node-20-a:
+ node_version: 20.x
+ part: a
+ node-20-b:
+ node_version: 20.x
+ part: b
steps:
- - task: NodeTool@0
+ - task: UseNode@1
inputs:
- versionSpec: $(node_version)
+ version: $(node_version)
displayName: "Install Node.js $(node_version)"
- - script: |
- npm install --global yarn
- displayName: "Install Yarn"
- script: |
node -v
yarn -v
displayName: "Print versions"
- - task: CacheBeta@1
+ - task: Cache@2
inputs:
- key: yarn | $(Agent.OS) | yarn.lock
+ key: 'yarn | "$(Agent.OS)" | yarn.lock'
+ restoreKeys: |
+ yarn | "$(Agent.OS)"
+ yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
+ # Install old `jest` version and ignore platform problem for legacy node versions
+ - script: |
+ node -e "const fs = require('fs');fs.createReadStream('yarn.lock').pipe(fs.createWriteStream('.yarn.lock'));"
+ yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines
+ yarn --frozen-lockfile --ignore-engines
+ displayName: "Install dependencies (old node.js version)"
+ condition: eq(variables['node_version'], '10.x')
- script: yarn --frozen-lockfile
displayName: "Install dependencies"
+ condition: not(eq(variables['node_version'], '10.x'))
- script: yarn link --frozen-lockfile || true
displayName: "Link webpack"
continueOnError: true
- script: yarn link webpack --frozen-lockfile
displayName: "Link webpack into node_modules"
- script: |
- yarn cover:integration --ci --maxWorkers=2 --reporters=jest-junit
+ yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit || yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit -f
+ yarn cover:merge
+ env:
+ CI: "true"
displayName: "Run tests with coverage"
- task: PublishTestResults@2
inputs:
@@ -146,6 +153,10 @@ jobs:
testResultsFiles: "**/junit.xml"
condition: succeededOrFailed()
displayName: "Publish test results"
+ - script: node -e "const fs = require('fs');fs.createReadStream('.yarn.lock').pipe(fs.createWriteStream('yarn.lock'));"
+ displayName: "Restore original yarn.lock"
+ condition: eq(variables['node_version'], '10.x')
+
- job: Linux
dependsOn:
- basic
@@ -153,46 +164,66 @@ jobs:
pool:
vmImage: ubuntu-latest
strategy:
- maxParallel: 4
+ maxParallel: 6
matrix:
- node-10:
- node_version: ^10.13.0
- node-12:
- node_version: ^12.4.0
- node-14:
- node_version: ^14.0.0
- node-15:
- node_version: ^15.0.0
+ node-10-a:
+ node_version: 10.x
+ part: a
+ node-10-b:
+ node_version: 10.x
+ part: b
+ node-18-a:
+ node_version: 18.x
+ part: a
+ node-18-b:
+ node_version: 18.x
+ part: b
+ node-20-a:
+ node_version: 20.x
+ part: a
+ node-20-b:
+ node_version: 20.x
+ part: b
steps:
- - task: NodeTool@0
+ - task: UseNode@1
inputs:
- versionSpec: $(node_version)
+ version: $(node_version)
displayName: "Install Node.js $(node_version)"
- script: |
- curl -o- -L https://yarnpkg.com/install.sh | bash
- displayName: "Install Yarn"
- - script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v
yarn -v
displayName: "Print versions"
- - task: CacheBeta@1
+ - task: Cache@2
inputs:
- key: yarn | $(Agent.OS) | yarn.lock
+ key: 'yarn | "$(Agent.OS)" | yarn.lock'
+ restoreKeys: |
+ yarn | "$(Agent.OS)"
+ yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
+ # Doesn't work due to modified yarn.lock
+ condition: not(eq(variables['node_version'], '10.x'))
+ # Install old `jest` version and ignore platform problem for legacy node versions
+ - script: |
+ node -e "const fs = require('fs');fs.createReadStream('yarn.lock').pipe(fs.createWriteStream('.yarn.lock'));"
+ yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines
+ yarn --frozen-lockfile --ignore-engines
+ displayName: "Install dependencies (old node.js version)"
+ condition: eq(variables['node_version'], '10.x')
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile
- yarn link --frozen-lockfile || true
- yarn link webpack --frozen-lockfile
displayName: "Install dependencies"
+ condition: not(eq(variables['node_version'], '10.x'))
+ - script: yarn link --frozen-lockfile || true
+ displayName: "Link webpack"
+ continueOnError: true
+ - script: yarn link webpack --frozen-lockfile
+ displayName: "Link webpack into node_modules"
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
- yarn cover:integration --ci --maxWorkers=2 --reporters=jest-junit
+ yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit || yarn cover:integration:$(part) --ci --maxWorkers=2 --reporters=default --reporters=jest-junit -f
+ yarn cover:merge
+ env:
+ CI: "true"
displayName: "Run tests with coverage"
- task: PublishTestResults@2
inputs:
@@ -200,6 +231,9 @@ jobs:
testResultsFiles: "**/junit.xml"
condition: succeededOrFailed()
displayName: "Publish test results"
+ - script: node -e "const fs = require('fs');fs.createReadStream('.yarn.lock').pipe(fs.createWriteStream('yarn.lock'));"
+ displayName: "Restore original yarn.lock"
+ condition: eq(variables['node_version'], '10.x')
- job: macOS
dependsOn:
@@ -208,42 +242,65 @@ jobs:
pool:
vmImage: macOS-latest
strategy:
- maxParallel: 2
+ maxParallel: 6
matrix:
- node-12:
- node_version: ^12.4.0
- node-14:
- node_version: ^14.0.0
+ node-10-a:
+ node_version: 10.x
+ part: a
+ node-10-b:
+ node_version: 10.x
+ part: b
+ node-18-a:
+ node_version: 18.x
+ part: a
+ node-18-b:
+ node_version: 18.x
+ part: b
+ node-20-a:
+ node_version: 20.x
+ part: a
+ node-20-b:
+ node_version: 20.x
+ part: b
steps:
- - task: NodeTool@0
+ - task: UseNode@1
inputs:
- versionSpec: $(node_version)
+ version: $(node_version)
displayName: "Install Node.js $(node_version)"
- script: |
- curl -o- -L https://yarnpkg.com/install.sh | bash
- displayName: "Install Yarn"
- - script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
node -v
yarn -v
displayName: "Print versions"
- - task: CacheBeta@1
+ - task: Cache@2
inputs:
- key: yarn | $(Agent.OS) | yarn.lock
+ key: 'yarn | "$(Agent.OS)" | yarn.lock'
+ restoreKeys: |
+ yarn | "$(Agent.OS)"
+ yarn
path: $(YARN_CACHE_FOLDER)
displayName: "Cache Yarn packages"
+ # Doesn't work due to modified yarn.lock
+ condition: not(eq(variables['node_version'], '10.x'))
+ - script: |
+ node -e "const fs = require('fs');fs.createReadStream('yarn.lock').pipe(fs.createWriteStream('.yarn.lock'));"
+ yarn upgrade jest@^27.5.0 jest-circus@^27.5.0 jest-cli@^27.5.0 jest-diff@^27.5.0 jest-environment-node@^27.5.0 jest-junit@^13.0.0 @types/jest@^27.4.0 pretty-format@^27.0.2 husky@^8.0.3 lint-staged@^13.2.1 cspell@^6.31.1 open-cli@^7.2.0 coffee-loader@^1.0.0 babel-loader@^8.1.0 style-loader@^2.0.0 css-loader@^5.0.1 less-loader@^8.1.1 mini-css-extract-plugin@^1.6.1 --ignore-engines
+ yarn --frozen-lockfile --ignore-engines
+ displayName: "Install dependencies (old node.js version)"
+ condition: eq(variables['node_version'], '10.x')
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
yarn --frozen-lockfile
- yarn link --frozen-lockfile || true
- yarn link webpack --frozen-lockfile
displayName: "Install dependencies"
+ condition: not(eq(variables['node_version'], '10.x'))
+ - script: yarn link --frozen-lockfile || true
+ displayName: "Link webpack"
+ continueOnError: true
+ - script: yarn link webpack --frozen-lockfile
+ displayName: "Link webpack into node_modules"
- script: |
- set -e
- export PATH="$HOME/.yarn/bin:$HOME/.config/yarn/global/node_modules/.bin:$PATH"
- yarn cover:integration --ci --reporters=jest-junit
+ yarn cover:integration:$(part) --ci --reporters=default --reporters=jest-junit || yarn cover:integration:$(part) --ci --reporters=default --reporters=jest-junit -f
+ yarn cover:merge
+ env:
+ CI: "true"
displayName: "Run tests with coverage"
- task: PublishTestResults@2
inputs:
@@ -251,3 +308,6 @@ jobs:
testResultsFiles: "**/junit.xml"
condition: succeededOrFailed()
displayName: "Publish test results"
+ - script: node -e "const fs = require('fs');fs.createReadStream('.yarn.lock').pipe(fs.createWriteStream('yarn.lock'));"
+ displayName: "Restore original yarn.lock"
+ condition: eq(variables['node_version'], '10.x')
diff --git a/benchmark/md4-cache.js b/benchmark/md4-cache.js
new file mode 100644
index 00000000000..00d02519df5
--- /dev/null
+++ b/benchmark/md4-cache.js
@@ -0,0 +1,39 @@
+const createHash = require("../lib/util/createHash");
+
+const compare = require("./micro-compare");
+
+const size = 50;
+
+const strings = [];
+for (let count = 1; ; count *= 10) {
+ while (strings.length < count) {
+ const s = require("crypto").randomBytes(size).toString("hex");
+ strings.push(s);
+ const hash = createHash("native-md4");
+ hash.update(s);
+ hash.update(s);
+ hash.digest("hex");
+ }
+ let i = 0;
+ console.log(
+ `${count} different 200 char strings: ` +
+ compare(
+ "native md4",
+ () => {
+ const hash = createHash("native-md4");
+ const s = strings[(i = (i + 1) % strings.length)];
+ hash.update(s);
+ hash.update(s);
+ return hash.digest("hex");
+ },
+ "wasm md4",
+ () => {
+ const hash = createHash("md4");
+ const s = strings[(i = (i + 1) % strings.length)];
+ hash.update(s);
+ hash.update(s);
+ return hash.digest("hex");
+ }
+ )
+ );
+}
diff --git a/benchmark/md4.js b/benchmark/md4.js
new file mode 100644
index 00000000000..3b50d659c75
--- /dev/null
+++ b/benchmark/md4.js
@@ -0,0 +1,49 @@
+const createHash = require("../lib/util/createHash");
+
+const compare = require("./micro-compare");
+
+for (const size of [
+ 1, 10, 20, 40, 60, 80, 100, 200, 400, 1000, 1001, 5000, 8183, 8184, 8185,
+ 10000, 20000, 32768, 32769, 50000, 100000, 200000
+]) {
+ const longString = require("crypto").randomBytes(size).toString("hex");
+ const buffer = require("crypto").randomBytes(size * 2);
+ console.log(
+ `string ${longString.length} chars: ` +
+ compare(
+ "native md4",
+ () => {
+ const hash = createHash("native-md4");
+ hash.update(longString);
+ hash.update(longString);
+ return hash.digest("hex");
+ },
+ "wasm md4",
+ () => {
+ const hash = createHash("md4");
+ hash.update(longString);
+ hash.update(longString);
+ return hash.digest("hex");
+ }
+ )
+ );
+ console.log(
+ `buffer ${buffer.length} bytes: ` +
+ compare(
+ "native md4",
+ () => {
+ const hash = createHash("native-md4");
+ hash.update(buffer);
+ hash.update(buffer);
+ return hash.digest("hex");
+ },
+ "wasm md4",
+ () => {
+ const hash = createHash("md4");
+ hash.update(buffer);
+ hash.update(buffer);
+ return hash.digest("hex");
+ }
+ )
+ );
+}
diff --git a/benchmark/micro-compare.js b/benchmark/micro-compare.js
new file mode 100644
index 00000000000..fb4541bddcb
--- /dev/null
+++ b/benchmark/micro-compare.js
@@ -0,0 +1,44 @@
+let result;
+
+const measure = (fn, count) => {
+ const start = process.hrtime.bigint();
+ for (let i = 0; i < count; i++) result = fn();
+ return Number(process.hrtime.bigint() - start);
+};
+
+const NS_PER_MS = 1000000; // 1ms
+const MIN_DURATION = 100 * NS_PER_MS; // 100ms
+const MAX_DURATION = 1000 * NS_PER_MS; // 1000ms
+const MAX_WARMUP_DURATION = 1 * NS_PER_MS; // 1ms
+
+const format = (fast, slow, fastName, slowName, count) => {
+ return `${fastName} is ${
+ Math.round(((slow - fast) * 1000) / slow) / 10
+ }% faster than ${slowName} (${Math.round(fast / 100 / count) / 10} ยตs vs ${
+ Math.round(slow / 100 / count) / 10
+ } ยตs, ${count}x)`;
+};
+
+const compare = (n1, f1, n2, f2) => {
+ let count = 1;
+ while (true) {
+ const timings = [f1, f2, f1, f2, f1, f2].map(f => measure(f, count));
+ const t1 = Math.min(timings[0], timings[2], timings[4]);
+ const t2 = Math.min(timings[1], timings[3], timings[5]);
+ if (count === 1 && (t1 > MAX_WARMUP_DURATION || t2 > MAX_WARMUP_DURATION)) {
+ continue;
+ }
+ if (
+ (t1 > MIN_DURATION && t2 > MIN_DURATION) ||
+ t1 > MAX_DURATION ||
+ t2 > MAX_DURATION
+ ) {
+ return t1 > t2
+ ? format(t2, t1, n2, n1, count)
+ : format(t1, t2, n1, n2, count);
+ }
+ count *= 2;
+ }
+};
+
+module.exports = compare;
diff --git a/benchmark/xxhash64-vs-md4.js b/benchmark/xxhash64-vs-md4.js
new file mode 100644
index 00000000000..0ed6085596d
--- /dev/null
+++ b/benchmark/xxhash64-vs-md4.js
@@ -0,0 +1,45 @@
+const createHash = require("../lib/util/createHash");
+
+const compare = require("./micro-compare");
+
+for (const size of [
+ 1, 10, 20, 40, 60, 80, 100, 200, 400, 1000, 1001, 5000, 8183, 8184, 8185,
+ 10000, 20000, 32768, 32769, 50000, 100000, 200000
+]) {
+ const longString = require("crypto").randomBytes(size).toString("hex");
+ const buffer = require("crypto").randomBytes(size * 2);
+ console.log(
+ `string ${longString.length} chars: ` +
+ compare(
+ "wasm xxhash64",
+ () => {
+ const hash = createHash("xxhash64");
+ hash.update(longString);
+ return hash.digest("hex");
+ },
+ "wasm md4",
+ () => {
+ const hash = createHash("md4");
+ hash.update(longString);
+ return hash.digest("hex");
+ }
+ )
+ );
+ console.log(
+ `buffer ${buffer.length} bytes: ` +
+ compare(
+ "wasm xxhash64",
+ () => {
+ const hash = createHash("xxhash64");
+ hash.update(buffer);
+ return hash.digest("hex");
+ },
+ "wasm md4",
+ () => {
+ const hash = createHash("md4");
+ hash.update(buffer);
+ return hash.digest("hex");
+ }
+ )
+ );
+}
diff --git a/benchmark/xxhash64.js b/benchmark/xxhash64.js
new file mode 100644
index 00000000000..7219b233e8a
--- /dev/null
+++ b/benchmark/xxhash64.js
@@ -0,0 +1,49 @@
+const createHash = require("../lib/util/createHash");
+
+const compare = require("./micro-compare");
+
+for (const size of [
+ 1, 10, 20, 40, 60, 80, 100, 200, 400, 1000, 1001, 5000, 8183, 8184, 8185,
+ 10000, 20000, 32768, 32769, 50000, 100000, 200000
+]) {
+ const longString = require("crypto").randomBytes(size).toString("hex");
+ const buffer = require("crypto").randomBytes(size * 2);
+ console.log(
+ `string ${longString.length} chars: ` +
+ compare(
+ "wasm xxhash64",
+ () => {
+ const hash = createHash("xxhash64");
+ hash.update(longString);
+ hash.update(longString);
+ return hash.digest("hex");
+ },
+ "native md4",
+ () => {
+ const hash = createHash("native-md4");
+ hash.update(longString);
+ hash.update(longString);
+ return hash.digest("hex");
+ }
+ )
+ );
+ console.log(
+ `buffer ${buffer.length} bytes: ` +
+ compare(
+ "wasm xxhash64",
+ () => {
+ const hash = createHash("xxhash64");
+ hash.update(buffer);
+ hash.update(buffer);
+ return hash.digest("hex");
+ },
+ "native md4",
+ () => {
+ const hash = createHash("native-md4");
+ hash.update(buffer);
+ hash.update(buffer);
+ return hash.digest("hex");
+ }
+ )
+ );
+}
diff --git a/bin/webpack.js b/bin/webpack.js
index 0421e3c1b78..cbb748f7e6d 100755
--- a/bin/webpack.js
+++ b/bin/webpack.js
@@ -32,13 +32,41 @@ const runCommand = (command, args) => {
* @returns {boolean} is the package installed?
*/
const isInstalled = packageName => {
- try {
- require.resolve(packageName);
-
+ if (process.versions.pnp) {
return true;
- } catch (err) {
- return false;
}
+
+ const path = require("path");
+ const fs = require("graceful-fs");
+
+ let dir = __dirname;
+
+ do {
+ try {
+ if (
+ fs.statSync(path.join(dir, "node_modules", packageName)).isDirectory()
+ ) {
+ return true;
+ }
+ } catch (_error) {
+ // Nothing
+ }
+ } while (dir !== (dir = path.dirname(dir)));
+
+ // https://github.com/nodejs/node/blob/v18.9.1/lib/internal/modules/cjs/loader.js#L1274
+ // eslint-disable-next-line no-warning-comments
+ // @ts-ignore
+ for (const internalPath of require("module").globalPaths) {
+ try {
+ if (fs.statSync(path.join(internalPath, packageName)).isDirectory()) {
+ return true;
+ }
+ } catch (_error) {
+ // Nothing
+ }
+ }
+
+ return false;
};
/**
@@ -48,14 +76,22 @@ const isInstalled = packageName => {
const runCli = cli => {
const path = require("path");
const pkgPath = require.resolve(`${cli.package}/package.json`);
- // eslint-disable-next-line node/no-missing-require
const pkg = require(pkgPath);
- // eslint-disable-next-line node/no-missing-require
- require(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName]));
+
+ if (pkg.type === "module" || /\.mjs/i.test(pkg.bin[cli.binName])) {
+ import(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName])).catch(
+ err => {
+ console.error(err);
+ process.exitCode = 1;
+ }
+ );
+ } else {
+ require(path.resolve(path.dirname(pkgPath), pkg.bin[cli.binName]));
+ }
};
/**
- * @typedef {Object} CliOption
+ * @typedef {object} CliOption
* @property {string} name display name
* @property {string} package npm package name
* @property {string} binName name of the executable file
@@ -77,11 +113,11 @@ if (!cli.installed) {
const fs = require("graceful-fs");
const readLine = require("readline");
- const notify =
- "CLI for webpack must be installed.\n" + ` ${cli.name} (${cli.url})\n`;
+ const notify = `CLI for webpack must be installed.\n ${cli.name} (${cli.url})\n`;
console.error(notify);
+ /** @type {string | undefined} */
let packageManager;
if (fs.existsSync(path.resolve(process.cwd(), "yarn.lock"))) {
@@ -100,7 +136,7 @@ if (!cli.installed) {
)} ${cli.package}".`
);
- const question = `Do you want to install 'webpack-cli' (yes/no): `;
+ const question = "Do you want to install 'webpack-cli' (yes/no): ";
const questionInterface = readLine.createInterface({
input: process.stdin,
@@ -134,12 +170,15 @@ if (!cli.installed) {
}')...`
);
- runCommand(packageManager, installOptions.concat(cli.package))
+ runCommand(
+ /** @type {string} */ (packageManager),
+ installOptions.concat(cli.package)
+ )
.then(() => {
runCli(cli);
})
- .catch(error => {
- console.error(error);
+ .catch(err => {
+ console.error(err);
process.exitCode = 1;
});
});
diff --git a/codecov.yml b/codecov.yml
index 9082ed53a44..24fc54029bb 100644
--- a/codecov.yml
+++ b/codecov.yml
@@ -1,5 +1,5 @@
codecov:
- branch: master
+ branch: main
coverage:
precision: 2
round: down
diff --git a/cspell.json b/cspell.json
index 1f5e3a39996..14086b9e9c2 100644
--- a/cspell.json
+++ b/cspell.json
@@ -1,231 +1,329 @@
{
- "version": "0.1",
+ "version": "0.2",
"language": "en",
"words": [
- "webpack",
- "webpack's",
- "endregion",
- "entrypoint",
- "entrypoints",
- "splitted",
- "dedupe",
- "deduplication",
- "deduplicating",
- "unoptimized",
- "prefetch",
- "prefetching",
- "prefetched",
- "preload",
- "preloading",
- "preloaded",
- "gzipping",
- "submodule",
- "submodules",
- "typeof",
- "devtool",
- "wasi",
- "wasm",
- "webassembly",
- "IIFE",
- "IIFE's",
+ "absolutify",
+ "abortable",
+ "acircular",
+ "amdmodule",
+ "analyse",
+ "analysed",
+ "asmjs",
+ "assemblyscript",
+ "asyncloader",
+ "atlaskit",
+ "autocrlf",
+ "babeljs",
+ "backport",
+ "backported",
+ "basictest",
"bigint",
- "unexception",
- "etag",
+ "bindgen",
+ "Birรณ",
+ "bitfield",
+ "bomfile",
+ "booleanized",
+ "boolish",
+ "brotli",
+ "browserified",
+ "browserslist",
+ "browserslistrc",
+ "browsertest",
+ "Brumme",
+ "bugfix",
+ "bugfixes",
"builtins",
- "uncacheable",
"cacheable",
- "mergeable",
+ "callme",
+ "camelcase",
+ "chainable",
+ "chunkfilename",
+ "chunkhash",
+ "chunkname",
+ "cmodule",
+ "codecov",
+ "cofounder",
+ "Collet's",
+ "compat",
+ "concated",
+ "contenthash",
+ "contextifies",
+ "cspellcache",
+ "crossorigin",
+ "csvg",
+ "cujojs",
+ "Dani",
+ "darkblue",
+ "darkgreen",
+ "darkred",
+ "datastructures",
+ "declarators",
+ "dedupe",
+ "deduplicating",
+ "deduplication",
+ "defunctzombie",
+ "deopt",
+ "deopts",
+ "dependabot",
+ "Descr",
+ "deserialization",
+ "destructure",
+ "devtool",
"devtools",
- "transpiled",
- "mixins",
- "subdir",
+ "donotcallme",
+ "eslintcache",
+ "endregion",
+ "entrypoint",
+ "entrypoints",
+ "Eoksni",
+ "eqeqeq",
"errored",
+ "esmodule",
+ "estree",
+ "etag",
+ "etags",
"eval",
- "multiplicator",
- "finalizer",
- "promisify",
- "absolutify",
- "camelcase",
+ "Ewald",
+ "exitance",
+ "fetchpriority",
"filebase",
- "moduleid",
- "modulehash",
- "chunkfilename",
- "chunkname",
- "chunkhash",
+ "fileoverview",
+ "filepath",
+ "finalizer",
+ "fsevents",
"fullhash",
- "contenthash",
+ "funcindex",
+ "functype",
+ "gcov",
+ "gibibytes",
+ "gitattributes",
+ "gitter",
+ "global's",
+ "globstar",
+ "gzipping",
"hashable",
+ "hashbang",
+ "hashchange",
+ "hashs",
+ "hotpink",
"hotupdatechunk",
+ "ident",
+ "idents",
+ "IIFE",
+ "IIFE's",
+ "informations",
+ "instanceof",
+ "inversed",
+ "jhnns",
+ "jrburke",
+ "jsfile",
+ "jsons",
+ "junit",
+ "Junya",
+ "jsdoc",
+ "kaios",
+ "Kees",
+ "kibibytes",
+ "Kluskens",
+ "Koppers",
+ "laof",
+ "Larkin",
+ "lcov",
+ "lcovonly",
+ "lintunit",
+ "loadername",
+ "loglevel",
+ "longnameforexport",
+ "longtest",
+ "mangleable",
+ "MCEP",
+ "mebibytes",
+ "medikoo",
+ "membertest",
+ "memfs",
+ "mergeable",
+ "metacharacters",
+ "microtask",
+ "microtasks",
"middleware",
"middlewares",
+ "mimetype",
+ "mixins",
+ "modulehash",
+ "moduleid",
+ "modulos",
+ "moji",
+ "MONEI",
+ "mult",
+ "multiplicator",
+ "mylibrary",
+ "mynamespace",
+ "navigations",
+ "nmodule",
+ "noimport",
+ "nonexistentfile",
+ "nonrecursive",
+ "nosource",
+ "nosources",
+ "nwjs",
+ "onconnect",
+ "opencollective",
+ "opensource",
+ "opuuus",
+ "overridable",
+ "overridables",
+ "parallelism",
+ "passthrough",
+ "pathinfo",
+ "performant",
+ "Phoscur",
+ "pmodule",
+ "pnpm",
+ "polyfilled",
+ "popstate",
+ "posthtml",
+ "precompute",
+ "prefetch",
+ "prefetched",
+ "prefetching",
+ "preload",
+ "preloaded",
+ "preloading",
+ "preparsed",
+ "preprocess",
+ "prettierrc",
+ "prewalking",
+ "prioritise",
+ "promisify",
+ "proxied",
+ "quasis",
+ "queryloader",
+ "querystrings",
+ "RBDT",
+ "reconsume",
+ "recurse",
+ "redeclaration",
+ "reexecuted",
+ "referenceable",
+ "referencer",
+ "repo",
+ "repos",
+ "return'development",
+ "returnfalse",
+ "revparse",
+ "rimraf",
+ "Rivest",
+ "rrrlll",
+ "runtime",
+ "runtimes",
+ "samsunginternet",
+ "sandboxed",
+ "serializables",
"serializer",
"serializers",
- "deserialization",
- "referenceable",
- "polyfilled",
- "transpiling",
- "transpile",
- "transpiles",
+ "shama",
+ "skypack",
"snapshotting",
+ "sokra",
+ "somepackage",
+ "somepath",
"sourcemap",
- "nosources",
- "filepath",
+ "sourcemapped",
+ "splitted",
+ "stylesheet",
+ "slsh",
+ "subdir",
+ "subfolder",
+ "submodule",
+ "submodules",
"subpath",
- "pathinfo",
- "undelayed",
- "microtask",
- "microtasks",
- "deopt",
- "deopts",
- "sandboxed",
- "mangleable",
- "passthrough",
- "prioritise",
- "booleanized",
- "serializables",
- "unreviewed",
- "unshifted",
- "nonrecursive",
+ "substack",
"symlinked",
- "subfolder",
- "prettierrc",
+ "syncloader",
+ "systemjs",
+ "tapable",
"templated",
"templating",
- "kibibytes",
- "mebibytes",
- "gibibytes",
- "typechecker",
- "recurse",
- "preparsed",
- "autocrlf",
- "lcov",
- "lcovonly",
- "gcov",
- "lintunit",
- "instanceof",
- "loglevel",
- "runtime",
- "runtimes",
- "mimetype",
+ "testcase",
+ "testlink",
+ "testloader",
"testvalue",
+ "timestamping",
+ "tmpl",
+ "toplevel",
+ "traceur",
+ "transpile",
+ "transpiled",
+ "transpiles",
+ "transpiling",
+ "triaging",
+ "Tshs",
+ "typechecker",
+ "typeof",
+ "ufeff",
+ "uncacheable",
+ "undefine",
+ "undelayed",
+ "unexception",
+ "unoptimized",
+ "unreviewed",
+ "unshifted",
+ "unsplittable",
+ "untaint",
"unusedkey",
"unusedvalue",
- "performant",
- "watchings",
- "jsons",
- "exitance",
- "ident",
- "idents",
- "globstar",
- "inversed",
- "concated",
- "RBDT",
- "opensource",
- "bugfix",
- "bugfixes",
- "declarators",
- "rrrlll",
- "undefine",
- "finializer",
- "quasis",
- "hashs",
- "functype",
- "funcindex",
- "Descr",
+ "url's",
+ "valign",
"valtype",
- "informations",
- "reexecuted",
- "global's",
- "unsplittable",
- "chainable",
- "metacharacters",
+ "wasi",
+ "wasm",
+ "watchings",
+ "watchpack",
+ "webassembly",
+ "webassemblyjs",
+ "webmake",
+ "webpack",
+ "webpack's",
"Xarray",
+ "Xexports",
"Xfactory",
"Xmodule",
- "Xexports",
- "moji",
- "bitfield",
- "precompute",
- "toplevel",
- "modulos",
- "untaint",
- "ufeff",
- "timestamping",
- "loadername",
- "laof",
- "cofounder",
- "hashchange",
- "popstate",
- "hotpink",
- "navigations",
- "compat",
- "noimport",
- "tmpl",
- "csvg",
- "repo",
- "repos",
- "triaging",
- "valign",
- "returnfalse",
- "return'development",
- "datastructures",
- "prewalking",
- "overridables",
- "overridable",
- "darkblue",
- "darkgreen",
- "darkred",
- "eqeqeq",
- "boolish",
- "analysing",
- "etags",
- "destructure",
- "onconnect",
- "nwjs",
- "redeclaration",
- "kaios",
- "parallelism",
-
- "webassemblyjs",
- "fsevents",
- "watchpack",
- "tapable",
- "junit",
- "memfs",
- "rimraf",
- "estree",
- "posthtml",
- "MCEP",
- "traceur",
- "atlaskit",
+ "xxhash",
"xxhashjs",
- "systemjs",
-
- "sokra",
- "Koppers",
- "Junya",
- "Eoksni",
- "Ewald",
- "Larkin",
- "Kees",
- "Kluskens",
- "Phoscur",
- "defunctzombie",
- "shama",
- "jhnns",
- "substack",
- "MONEI",
- "medikoo",
- "webmake",
- "jrburke",
- "gitter",
- "codecov",
- "opencollective",
- "dependabot",
- "browserslist",
- "samsunginternet",
- "pnpm"
+ "Yann",
+ "readonly",
+ "commithash",
+ "formaters"
+ ],
+ "ignoreRegExpList": [
+ "/Author.+/",
+ "/data:.*/",
+ "/\"mappings\":\".+\"/",
+ "/toMatchInlineSnapshot\\(\\s*`[^`]*`\\s*\\)/"
],
- "ignoreRegExpList": ["/Author.+/", "/data:.*/", "/\"mappings\":\".+\"/"],
- "ignorePaths": ["**/dist/**", "examples/**/README.md"]
+ "ignorePaths": [
+ "**/dist/**",
+ "**/node_modules/**",
+ "examples/**/README.md",
+ "examples/wasm-bindgen*/pkg/*_bg.js",
+ "examples/wasm-bindgen*/pkg/*_bg*.d.ts",
+ "**/webpack.lock.data/**",
+ "package.json",
+ "yarn.lock",
+ "types.d.ts",
+ "**/**/*.snap",
+ "test/cases/json/weird-properties/globals.json",
+ "test/JavascriptParser.unittest.js",
+ "**/*.svg",
+ "*.log",
+ "**/*.wasm",
+ "coverage/**",
+ "test/**/module.js",
+ "test/js/**",
+ "test/cases/**",
+ "test/configCases/**",
+ "test/statsCases/**",
+ "test/fixtures/**",
+ "test/memoryLimitCases/**"
+ ]
}
diff --git a/declarations.d.ts b/declarations.d.ts
index 93ef7942486..787a6d57c50 100644
--- a/declarations.d.ts
+++ b/declarations.d.ts
@@ -124,17 +124,19 @@ declare module "neo-async" {
// There are no typings for @webassemblyjs/ast
declare module "@webassemblyjs/ast" {
+ export interface Visitor {
+ ModuleImport?: (p: NodePath) => void;
+ ModuleExport?: (p: NodePath) => void;
+ Start?: (p: NodePath) => void;
+ Global?: (p: NodePath) => void;
+ }
export function traverse(
ast: any,
- visitor: {
- ModuleImport?: (p: NodePath) => void;
- ModuleExport?: (p: NodePath) => void;
- Start?: (p: NodePath) => void;
- Global?: (p: NodePath) => void;
- }
+ visitor: Visitor
): void;
export class NodePath {
node: T;
+ remove(): void;
}
export class Node {}
export class Identifier extends Node {
@@ -148,6 +150,7 @@ declare module "@webassemblyjs/ast" {
valtype?: string;
id?: Identifier;
signature?: Signature;
+ mutability: string;
}
export class ModuleImport extends Node {
module: string;
@@ -171,6 +174,7 @@ declare module "@webassemblyjs/ast" {
export class FloatLiteral extends Node {}
export class GlobalType extends Node {
valtype: string;
+ mutability: string;
}
export class Global extends Node {
init: Instruction[];
@@ -204,7 +208,7 @@ declare module "@webassemblyjs/ast" {
raw?: string
): FloatLiteral;
export function global(globalType: string, nodes: Node[]): Global;
- export function identifier(indentifier: string): Identifier;
+ export function identifier(identifier: string): Identifier;
export function funcParam(valType: string, id: Identifier): FuncParam;
export function instruction(inst: string, args?: Node[]): Instruction;
export function callInstruction(funcIndex: Index): CallInstruction;
@@ -214,9 +218,9 @@ declare module "@webassemblyjs/ast" {
init: Node[]
): ObjectInstruction;
export function signature(params: FuncParam[], results: string[]): Signature;
- export function func(initFuncId, signature: Signature, funcBody): Func;
+ export function func(initFuncId: Identifier, signature: Signature, funcBody: Instruction[]): Func;
export function typeInstruction(
- id: Identifier,
+ id: Identifier | undefined,
functype: Signature
): TypeInstruction;
export function indexInFuncSection(index: Index): IndexInFuncSection;
@@ -229,7 +233,7 @@ declare module "@webassemblyjs/ast" {
index: Index
): ModuleExportDescr;
- export function getSectionMetadata(ast: any, section: string);
+ export function getSectionMetadata(ast: any, section: string): { vectorOfSize: { value: number } };
export class FuncSignature {
args: string[];
result: string[];
@@ -243,17 +247,34 @@ declare module "@webassemblyjs/ast" {
export function isFuncImportDescr(n: Node): boolean;
}
+declare module "@webassemblyjs/wasm-parser" {
+ export function decode(source: string | Buffer, options: { dump?: boolean, ignoreCodeSection?: boolean, ignoreDataSection?: boolean, ignoreCustomNameSection?: boolean }): any;
+}
+
+declare module "@webassemblyjs/wasm-edit" {
+ export function addWithAST(ast: any, bin: any, newNodes: import("@webassemblyjs/ast").Node[]): ArrayBuffer;
+ export function editWithAST(ast: any, bin: any, visitors: import("@webassemblyjs/ast").Visitor): ArrayBuffer;
+}
+
declare module "webpack-sources" {
export type MapOptions = { columns?: boolean; module?: boolean };
+ export type RawSourceMap = {
+ version: number;
+ sources: string[];
+ names: string[];
+ sourceRoot?: string;
+ sourcesContent?: string[];
+ mappings: string;
+ file: string;
+ };
+
export abstract class Source {
size(): number;
- map(options?: MapOptions): Object;
+ map(options?: MapOptions): RawSourceMap | null;
- sourceAndMap(
- options?: MapOptions
- ): {
+ sourceAndMap(options?: MapOptions): {
source: string | Buffer;
map: Object;
};
@@ -373,6 +394,18 @@ declare module "browserslist" {
export = browserslist;
}
+declare module "json-parse-even-better-errors" {
+ function parseJson(text: string, reviver?: (this: any, key: string, value: any) => any, context?: number): any;
+ export = parseJson;
+}
+
+// TODO remove that when @types/estree is updated
+interface ImportAttributeNode {
+ type: "ImportAttribute";
+ key: import("estree").Identifier | import("estree").Literal;
+ value: import("estree").Literal;
+}
+
type TODO = any;
type RecursiveArrayOrRecord =
diff --git a/declarations/LoaderContext.d.ts b/declarations/LoaderContext.d.ts
new file mode 100644
index 00000000000..533a60828f8
--- /dev/null
+++ b/declarations/LoaderContext.d.ts
@@ -0,0 +1,292 @@
+import type { SourceMap } from "../lib/NormalModule";
+import type Module from "../lib/Module";
+import type { validate } from "schema-utils";
+import type { AssetInfo } from "../lib/Compilation";
+import type { ResolveOptionsWithDependencyType } from "../lib/ResolverFactory";
+import type Compilation from "../lib/Compilation";
+import type Compiler from "../lib/Compiler";
+import type NormalModule from "../lib/NormalModule";
+import type Hash from "../lib/util/Hash";
+import type { InputFileSystem } from "../lib/util/fs";
+import type { Logger } from "../lib/logging/Logger";
+import type {
+ ImportModuleCallback,
+ ImportModuleOptions
+} from "../lib/dependencies/LoaderPlugin";
+import type { Resolver } from "enhanced-resolve";
+import type { Environment } from "./WebpackOptions";
+
+type ResolveCallback = Parameters[4];
+type Schema = Parameters[0];
+
+/** These properties are added by the NormalModule */
+export interface NormalModuleLoaderContext {
+ version: number;
+ getOptions(): OptionsType;
+ getOptions(schema: Schema): OptionsType;
+ emitWarning(warning: Error): void;
+ emitError(error: Error): void;
+ getLogger(name?: string): Logger;
+ resolve(context: string, request: string, callback: ResolveCallback): any;
+ getResolve(
+ options?: ResolveOptionsWithDependencyType
+ ): ((context: string, request: string, callback: ResolveCallback) => void) &
+ ((context: string, request: string) => Promise);
+ emitFile(
+ name: string,
+ content: string | Buffer,
+ sourceMap?: string,
+ assetInfo?: AssetInfo
+ ): void;
+ addBuildDependency(dep: string): void;
+ utils: {
+ absolutify: (context: string, request: string) => string;
+ contextify: (context: string, request: string) => string;
+ createHash: (algorithm?: string | typeof Hash) => Hash;
+ };
+ rootContext: string;
+ fs: InputFileSystem;
+ sourceMap?: boolean;
+ mode: "development" | "production" | "none";
+ webpack?: boolean;
+ _module?: NormalModule;
+ _compilation?: Compilation;
+ _compiler?: Compiler;
+}
+
+/** These properties are added by the HotModuleReplacementPlugin */
+export interface HotModuleReplacementPluginLoaderContext {
+ hot?: boolean;
+}
+
+/** These properties are added by the LoaderPlugin */
+export interface LoaderPluginLoaderContext {
+ /**
+ * Resolves the given request to a module, applies all configured loaders and calls
+ * back with the generated source, the sourceMap and the module instance (usually an
+ * instance of NormalModule). Use this function if you need to know the source code
+ * of another module to generate the result.
+ */
+ loadModule(
+ request: string,
+ callback: (
+ err: Error | null,
+ source?: string | Buffer,
+ sourceMap?: object | null,
+ module?: Module
+ ) => void
+ ): void;
+
+ importModule(
+ request: string,
+ options: ImportModuleOptions | undefined,
+ callback: ImportModuleCallback
+ ): void;
+ importModule(request: string, options?: ImportModuleOptions): Promise;
+}
+
+/** The properties are added by https://github.com/webpack/loader-runner */
+export interface LoaderRunnerLoaderContext {
+ /**
+ * Add a directory as dependency of the loader result.
+ */
+ addContextDependency(context: string): void;
+
+ /**
+ * Adds a file as dependency of the loader result in order to make them watchable.
+ * For example, html-loader uses this technique as it finds src and src-set attributes.
+ * Then, it sets the url's for those attributes as dependencies of the html file that is parsed.
+ */
+ addDependency(file: string): void;
+
+ addMissingDependency(context: string): void;
+
+ /**
+ * Make this loader async.
+ */
+ async(): WebpackLoaderContextCallback;
+
+ /**
+ * Make this loader result cacheable. By default it's cacheable.
+ * A cacheable loader must have a deterministic result, when inputs and dependencies haven't changed.
+ * This means the loader shouldn't have other dependencies than specified with this.addDependency.
+ * Most loaders are deterministic and cacheable.
+ */
+ cacheable(flag?: boolean): void;
+
+ callback: WebpackLoaderContextCallback;
+
+ /**
+ * Remove all dependencies of the loader result. Even initial dependencies and these of other loaders.
+ */
+ clearDependencies(): void;
+
+ /**
+ * The directory of the module. Can be used as context for resolving other stuff.
+ * eg '/workspaces/ts-loader/examples/vanilla/src'
+ */
+ context: string;
+
+ readonly currentRequest: string;
+
+ readonly data: any;
+ /**
+ * alias of addDependency
+ * Adds a file as dependency of the loader result in order to make them watchable.
+ * For example, html-loader uses this technique as it finds src and src-set attributes.
+ * Then, it sets the url's for those attributes as dependencies of the html file that is parsed.
+ */
+ dependency(file: string): void;
+
+ getContextDependencies(): string[];
+
+ getDependencies(): string[];
+
+ getMissingDependencies(): string[];
+
+ /**
+ * The index in the loaders array of the current loader.
+ * In the example: in loader1: 0, in loader2: 1
+ */
+ loaderIndex: number;
+
+ readonly previousRequest: string;
+
+ readonly query: string | OptionsType;
+
+ readonly remainingRequest: string;
+
+ readonly request: string;
+
+ /**
+ * An array of all the loaders. It is writeable in the pitch phase.
+ * loaders = [{request: string, path: string, query: string, module: function}]
+ *
+ * In the example:
+ * [
+ * { request: "/abc/loader1.js?xyz",
+ * path: "/abc/loader1.js",
+ * query: "?xyz",
+ * module: [Function]
+ * },
+ * { request: "/abc/node_modules/loader2/index.js",
+ * path: "/abc/node_modules/loader2/index.js",
+ * query: "",
+ * module: [Function]
+ * }
+ * ]
+ */
+ loaders: {
+ request: string;
+ path: string;
+ query: string;
+ fragment: string;
+ options: object | string | undefined;
+ ident: string;
+ normal: Function | undefined;
+ pitch: Function | undefined;
+ raw: boolean | undefined;
+ data: object | undefined;
+ pitchExecuted: boolean;
+ normalExecuted: boolean;
+ type?: "commonjs" | "module" | undefined;
+ }[];
+
+ /**
+ * The resource path.
+ * In the example: "/abc/resource.js"
+ */
+ resourcePath: string;
+
+ /**
+ * The resource query string.
+ * Example: "?query"
+ */
+ resourceQuery: string;
+
+ /**
+ * The resource fragment.
+ * Example: "#frag"
+ */
+ resourceFragment: string;
+
+ /**
+ * The resource inclusive query and fragment.
+ * Example: "/abc/resource.js?query#frag"
+ */
+ resource: string;
+
+ /**
+ * Target of compilation.
+ * Example: "web"
+ */
+ target: string;
+
+ /**
+ * Tell what kind of ES-features may be used in the generated runtime-code.
+ * Example: { arrowFunction: true }
+ */
+ environment: Environment;
+}
+
+type AdditionalData = {
+ webpackAST: object;
+ [index: string]: any;
+};
+
+type WebpackLoaderContextCallback = (
+ err: Error | undefined | null,
+ content?: string | Buffer,
+ sourceMap?: string | SourceMap,
+ additionalData?: AdditionalData
+) => void;
+
+type LoaderContext = NormalModuleLoaderContext &
+ LoaderRunnerLoaderContext &
+ LoaderPluginLoaderContext &
+ HotModuleReplacementPluginLoaderContext;
+
+type PitchLoaderDefinitionFunction = (
+ this: LoaderContext & ContextAdditions,
+ remainingRequest: string,
+ previousRequest: string,
+ data: object
+) => string | Buffer | Promise | void;
+
+type LoaderDefinitionFunction = (
+ this: LoaderContext & ContextAdditions,
+ content: string,
+ sourceMap?: string | SourceMap,
+ additionalData?: AdditionalData
+) => string | Buffer | Promise | void;
+
+type RawLoaderDefinitionFunction = (
+ this: LoaderContext & ContextAdditions,
+ content: Buffer,
+ sourceMap?: string | SourceMap,
+ additionalData?: AdditionalData
+) => string | Buffer | Promise | void;
+
+export type LoaderDefinition<
+ OptionsType = {},
+ ContextAdditions = {}
+> = LoaderDefinitionFunction & {
+ raw?: false;
+ pitch?: PitchLoaderDefinitionFunction;
+};
+
+export type RawLoaderDefinition<
+ OptionsType = {},
+ ContextAdditions = {}
+> = RawLoaderDefinitionFunction & {
+ raw: true;
+ pitch?: PitchLoaderDefinitionFunction;
+};
+
+export interface LoaderModule {
+ default?:
+ | RawLoaderDefinitionFunction
+ | LoaderDefinitionFunction;
+ raw?: false;
+ pitch?: PitchLoaderDefinitionFunction;
+}
diff --git a/declarations/WebpackOptions.d.ts b/declarations/WebpackOptions.d.ts
index 793f421c758..1b7e8f875e7 100644
--- a/declarations/WebpackOptions.d.ts
+++ b/declarations/WebpackOptions.d.ts
@@ -35,6 +35,14 @@ export type Context = string;
* References to other configurations to depend on.
*/
export type Dependencies = string[];
+/**
+ * Options for the webpack-dev-server.
+ */
+export type DevServer =
+ | false
+ | {
+ [k: string]: any;
+ };
/**
* A developer tool to enhance debugging (false | eval | [inline-|hidden-|eval-][nosources-][cheap-[module-]]source-map).
*/
@@ -56,14 +64,14 @@ export type EntryStatic = EntryObject | EntryUnnamed;
*/
export type EntryItem = string[] | string;
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
export type ChunkLoading = false | ChunkLoadingType;
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
export type ChunkLoadingType =
- | ("jsonp" | "import-scripts" | "require" | "async-node")
+ | ("jsonp" | "import-scripts" | "require" | "async-node" | "import")
| string;
/**
* Specifies the filename of the output file on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
@@ -82,6 +90,10 @@ export type FilenameTemplate =
* Specifies the layer in which modules of this entrypoint are placed.
*/
export type Layer = null | string;
+/**
+ * Add a container for define/require functions in the AMD module.
+ */
+export type AmdContainer = string;
/**
* Add a comment in the UMD wrapper.
*/
@@ -95,7 +107,7 @@ export type LibraryExport = string[] | string;
*/
export type LibraryName = string[] | string | LibraryCustomUmdObject;
/**
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
export type LibraryType =
| (
@@ -110,6 +122,7 @@ export type LibraryType =
| "commonjs"
| "commonjs2"
| "commonjs-module"
+ | "commonjs-static"
| "amd"
| "amd-require"
| "umd"
@@ -122,10 +135,23 @@ export type LibraryType =
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
*/
export type UmdNamedDefine = boolean;
+/**
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
+ */
+export type PublicPath = "auto" | RawPublicPath;
+/**
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
+ */
+export type RawPublicPath =
+ | string
+ | ((
+ pathData: import("../lib/Compilation").PathData,
+ assetInfo?: import("../lib/Compilation").AssetInfo
+ ) => string);
/**
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
*/
-export type EntryRuntime = string;
+export type EntryRuntime = false | string;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
@@ -140,6 +166,18 @@ export type WasmLoadingType =
* An entry point without name.
*/
export type EntryUnnamed = EntryItem;
+/**
+ * Enables/Disables experiments (experimental features with relax SemVer compatibility).
+ */
+export type Experiments = ExperimentsCommon & ExperimentsExtra;
+/**
+ * Extend configuration from another configuration (only works when using webpack-cli).
+ */
+export type Extends = ExtendsItem[] | ExtendsItem;
+/**
+ * Path to the configuration to be extended (only works when using webpack-cli).
+ */
+export type ExtendsItem = string;
/**
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
*/
@@ -154,7 +192,7 @@ export type ExternalItem =
| (
| ((
data: ExternalItemFunctionData,
- callback: (err?: Error, result?: ExternalItemValue) => void
+ callback: (err?: Error | null, result?: ExternalItemValue) => void
) => void)
| ((data: ExternalItemFunctionData) => Promise)
);
@@ -172,6 +210,7 @@ export type ExternalsType =
| "commonjs"
| "commonjs2"
| "commonjs-module"
+ | "commonjs-static"
| "amd"
| "amd-require"
| "umd"
@@ -180,7 +219,9 @@ export type ExternalsType =
| "system"
| "promise"
| "import"
- | "script";
+ | "module-import"
+ | "script"
+ | "node-commonjs";
/**
* Ignore specific warnings.
*/
@@ -217,6 +258,10 @@ export type FilterItemTypes = RegExp | string | ((value: string) => boolean);
* Enable production optimizations or development hints.
*/
export type Mode = "development" | "production" | "none";
+/**
+ * These values will be ignored by webpack and created to be used with '&&' or '||' to improve readability of configurations.
+ */
+export type Falsy = false | 0 | "" | null | undefined;
/**
* One or multiple rule conditions.
*/
@@ -227,21 +272,8 @@ export type RuleSetConditionOrConditions = RuleSetCondition | RuleSetConditions;
export type RuleSetCondition =
| RegExp
| string
- | {
- /**
- * Logical AND.
- */
- and?: RuleSetConditions;
- /**
- * Logical NOT.
- */
- not?: RuleSetConditions;
- /**
- * Logical OR.
- */
- or?: RuleSetConditions;
- }
| ((value: string) => boolean)
+ | RuleSetLogicalConditions
| RuleSetConditions;
/**
* A list of rule conditions.
@@ -259,21 +291,8 @@ export type RuleSetConditionOrConditionsAbsolute =
export type RuleSetConditionAbsolute =
| RegExp
| string
- | {
- /**
- * Logical AND.
- */
- and?: RuleSetConditionsAbsolute;
- /**
- * Logical NOT.
- */
- not?: RuleSetConditionsAbsolute;
- /**
- * Logical OR.
- */
- or?: RuleSetConditionsAbsolute;
- }
| ((value: string) => boolean)
+ | RuleSetLogicalConditionsAbsolute
| RuleSetConditionsAbsolute;
/**
* A list of rule conditions matching an absolute path.
@@ -315,18 +334,33 @@ export type ResolveAlias =
*/
[k: string]: string[] | false | string;
};
+/**
+ * Plugin instance.
+ */
+export type ResolvePluginInstance =
+ | {
+ /**
+ * The run point of the plugin, required method.
+ */
+ apply: (arg0: import("enhanced-resolve").Resolver) => void;
+ [k: string]: any;
+ }
+ | ((
+ this: import("enhanced-resolve").Resolver,
+ arg1: import("enhanced-resolve").Resolver
+ ) => void);
/**
* A list of descriptions of loaders applied.
*/
export type RuleSetUse =
- | RuleSetUseItem[]
+ | (Falsy | RuleSetUseItem)[]
| ((data: {
resource: string;
realResource: string;
resourceQuery: string;
issuer: string;
compiler: string;
- }) => RuleSetUseItem[])
+ }) => (Falsy | RuleSetUseItem)[])
| RuleSetUseItem;
/**
* A description of an applied loader.
@@ -346,12 +380,12 @@ export type RuleSetUseItem =
*/
options?: RuleSetLoaderOptions;
}
- | ((data: object) => RuleSetUseItem | RuleSetUseItem[])
+ | ((data: object) => RuleSetUseItem | (Falsy | RuleSetUseItem)[])
| RuleSetLoader;
/**
* A list of rules.
*/
-export type RuleSetRules = ("..." | RuleSetRule)[];
+export type RuleSetRules = ("..." | Falsy | RuleSetRule)[];
/**
* Specify options for each generator.
*/
@@ -426,9 +460,11 @@ export type Charset = boolean;
*/
export type ChunkFilename = FilenameTemplate;
/**
- * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), but others might be added by plugins).
+ * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins).
*/
-export type ChunkFormat = ("array-push" | "commonjs" | false) | string;
+export type ChunkFormat =
+ | ("array-push" | "commonjs" | "module" | false)
+ | string;
/**
* Number of milliseconds before chunk request expires.
*/
@@ -449,6 +485,18 @@ export type CompareBeforeEmit = boolean;
* This option enables cross-origin loading of chunks.
*/
export type CrossOriginLoading = false | "anonymous" | "use-credentials";
+/**
+ * Specifies the filename template of non-initial output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
+ */
+export type CssChunkFilename = FilenameTemplate;
+/**
+ * Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
+ */
+export type CssFilename = FilenameTemplate;
+/**
+ * Compress the data in the head tag of CSS files.
+ */
+export type CssHeadDataCompression = boolean;
/**
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
*/
@@ -537,16 +585,6 @@ export type Path = string;
* Include comments with information about the modules.
*/
export type Pathinfo = "verbose" | boolean;
-/**
- * The `publicPath` specifies the public URL address of the output files when referenced in a browser.
- */
-export type PublicPath =
- | "auto"
- | string
- | ((
- pathData: import("../lib/Compilation").PathData,
- assetInfo?: import("../lib/Compilation").AssetInfo
- ) => string);
/**
* This option enables loading async chunks via a custom script type, such as script type="module".
*/
@@ -575,6 +613,10 @@ export type UniqueName = string;
* The filename of WebAssembly modules as relative path inside the 'output.path' directory.
*/
export type WebassemblyModuleFilename = string;
+/**
+ * Worker public path. Much like the public path, this sets the location where the worker script file is intended to be found. If not set, webpack will use the publicPath. Don't set this option unless your worker scripts are located at a different path from your other script files.
+ */
+export type WorkerPublicPath = string;
/**
* The number of parallel processed modules in the compilation.
*/
@@ -586,7 +628,7 @@ export type Performance = false | PerformanceOptions;
/**
* Add additional plugins to the compiler.
*/
-export type Plugins = (WebpackPluginInstance | WebpackPluginFunction)[];
+export type Plugins = (Falsy | WebpackPluginInstance | WebpackPluginFunction)[];
/**
* Capture timing information for each module.
*/
@@ -687,7 +729,7 @@ export type AssetGeneratorDataUrl =
| AssetGeneratorDataUrlOptions
| AssetGeneratorDataUrlFunction;
/**
- * Function that executes for module and should return an DataUrl string.
+ * Function that executes for module and should return an DataUrl string. It can have a string as 'ident' property which contributes to the module hash.
*/
export type AssetGeneratorDataUrlFunction = (
source: string | Buffer,
@@ -698,6 +740,15 @@ export type AssetGeneratorDataUrlFunction = (
*/
export type AssetGeneratorOptions = AssetInlineGeneratorOptions &
AssetResourceGeneratorOptions;
+/**
+ * Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
+ */
+export type AssetModuleOutputPath =
+ | string
+ | ((
+ pathData: import("../lib/Compilation").PathData,
+ assetInfo?: import("../lib/Compilation").AssetInfo
+ ) => string);
/**
* Function that executes for module and should return whenever asset should be inlined as DataUrl.
*/
@@ -705,6 +756,28 @@ export type AssetParserDataUrlFunction = (
source: string | Buffer,
context: {filename: string; module: import("../lib/Module")}
) => boolean;
+/**
+ * Configure the generated JS modules that use the ES modules syntax.
+ */
+export type CssGeneratorEsModule = boolean;
+/**
+ * Specifies the convention of exported names.
+ */
+export type CssGeneratorExportsConvention =
+ | ("as-is" | "camel-case" | "camel-case-only" | "dashes" | "dashes-only")
+ | ((name: string) => string);
+/**
+ * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
+ */
+export type CssGeneratorExportsOnly = boolean;
+/**
+ * Configure the generated local ident name.
+ */
+export type CssGeneratorLocalIdentName = string;
+/**
+ * Use ES modules named export for css exports.
+ */
+export type CssParserNamedExports = boolean;
/**
* A Function returning a Promise resolving to a normalized entry.
*/
@@ -713,6 +786,11 @@ export type EntryDynamicNormalized = () => Promise;
* The entry point(s) of the compilation.
*/
export type EntryNormalized = EntryDynamicNormalized | EntryStaticNormalized;
+/**
+ * Enables/Disables experiments (experimental features with relax SemVer compatibility).
+ */
+export type ExperimentsNormalized = ExperimentsCommon &
+ ExperimentsNormalizedExtra;
/**
* The dependency used for the external.
*/
@@ -723,6 +801,18 @@ export type ExternalItemValue =
| {
[k: string]: any;
};
+/**
+ * List of allowed URIs for building http resources.
+ */
+export type HttpUriAllowedUris = HttpUriOptionsAllowedUris;
+/**
+ * List of allowed URIs (resp. the beginning of them).
+ */
+export type HttpUriOptionsAllowedUris = (
+ | RegExp
+ | string
+ | ((uri: string) => boolean)
+)[];
/**
* Ignore specific warnings.
*/
@@ -791,6 +881,10 @@ export interface WebpackOptions {
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
*/
experiments?: Experiments;
+ /**
+ * Extend configuration from another configuration (only works when using webpack-cli).
+ */
+ extends?: Extends;
/**
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
*/
@@ -900,6 +994,14 @@ export interface WebpackOptions {
* Options object for in-memory caching.
*/
export interface MemoryCacheOptions {
+ /**
+ * Additionally cache computation of modules that are unchanged and reference only unchanged modules.
+ */
+ cacheUnaffected?: boolean;
+ /**
+ * Number of generations unused cache entries stay in memory cache at minimum (1 = may be removed after unused for a single compilation, ..., Infinity: kept forever).
+ */
+ maxGenerations?: number;
/**
* In memory caching.
*/
@@ -909,6 +1011,10 @@ export interface MemoryCacheOptions {
* Options object for persistent file-based caching.
*/
export interface FileCacheOptions {
+ /**
+ * Allows to collect unused memory allocated during deserialization. This requires copying data into smaller buffers and has a performance cost.
+ */
+ allowCollectingMemory?: boolean;
/**
* Dependencies the build depends on (in multiple categories, default categories: 'defaultWebpack').
*/
@@ -926,30 +1032,58 @@ export interface FileCacheOptions {
* Locations for the cache (defaults to cacheDirectory / name).
*/
cacheLocation?: string;
+ /**
+ * Compression type used for the cache files.
+ */
+ compression?: false | "gzip" | "brotli";
/**
* Algorithm used for generation the hash (see node.js crypto package).
*/
hashAlgorithm?: string;
/**
- * Time in ms after which idle period the cache storing should happen (only for store: 'pack' or 'idle').
+ * Time in ms after which idle period the cache storing should happen.
*/
idleTimeout?: number;
/**
- * Time in ms after which idle period the initial cache storing should happen (only for store: 'pack' or 'idle').
+ * Time in ms after which idle period the cache storing should happen when larger changes has been detected (cumulative build time > 2 x avg cache store time).
+ */
+ idleTimeoutAfterLargeChanges?: number;
+ /**
+ * Time in ms after which idle period the initial cache storing should happen.
*/
idleTimeoutForInitialStore?: number;
/**
* List of paths that are managed by a package manager and contain a version or hash in its path so all files are immutable.
*/
- immutablePaths?: string[];
+ immutablePaths?: (RegExp | string)[];
/**
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
*/
- managedPaths?: string[];
+ managedPaths?: (RegExp | string)[];
+ /**
+ * Time for which unused cache entries stay in the filesystem cache at minimum (in milliseconds).
+ */
+ maxAge?: number;
+ /**
+ * Number of generations unused cache entries stay in memory cache at minimum (0 = no memory cache used, 1 = may be removed after unused for a single compilation, ..., Infinity: kept forever). Cache entries will be deserialized from disk when removed from memory cache.
+ */
+ maxMemoryGenerations?: number;
+ /**
+ * Additionally cache computation of modules that are unchanged and reference only unchanged modules in memory.
+ */
+ memoryCacheUnaffected?: boolean;
/**
* Name for the cache. Different names will lead to different coexisting caches.
*/
name?: string;
+ /**
+ * Track and log detailed timing information for individual cache items.
+ */
+ profile?: boolean;
+ /**
+ * Enable/disable readonly mode.
+ */
+ readonly?: boolean;
/**
* When to store data to the filesystem. (pack: Store data when compiler is idle in a single file).
*/
@@ -963,12 +1097,6 @@ export interface FileCacheOptions {
*/
version?: string;
}
-/**
- * Options for the webpack-dev-server.
- */
-export interface DevServer {
- [k: string]: any;
-}
/**
* Multiple entry bundles are created. The key is the entry name. The value can be a string, an array or an entry description object.
*/
@@ -983,7 +1111,15 @@ export interface EntryObject {
*/
export interface EntryDescription {
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * Enable/disable creating async chunks that are loaded on demand.
+ */
+ asyncChunks?: boolean;
+ /**
+ * Base uri for this entry.
+ */
+ baseUri?: string;
+ /**
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: ChunkLoading;
/**
@@ -1006,6 +1142,10 @@ export interface EntryDescription {
* Options for library.
*/
library?: LibraryOptions;
+ /**
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
+ */
+ publicPath?: PublicPath;
/**
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
*/
@@ -1019,6 +1159,10 @@ export interface EntryDescription {
* Options for library.
*/
export interface LibraryOptions {
+ /**
+ * Add a container for define/require functions in the AMD module.
+ */
+ amdContainer?: AmdContainer;
/**
* Add a comment in the UMD wrapper.
*/
@@ -1032,7 +1176,7 @@ export interface LibraryOptions {
*/
name?: LibraryName;
/**
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
type: LibraryType;
/**
@@ -1078,71 +1222,6 @@ export interface LibraryCustomUmdObject {
*/
root?: string[] | string;
}
-/**
- * Enables/Disables experiments (experimental features with relax SemVer compatibility).
- */
-export interface Experiments {
- /**
- * Allow module type 'asset' to generate assets.
- */
- asset?: boolean;
- /**
- * Support WebAssembly as asynchronous EcmaScript Module.
- */
- asyncWebAssembly?: boolean;
- /**
- * Enable module and chunk layers.
- */
- layers?: boolean;
- /**
- * Compile entrypoints and import()s only when they are accessed.
- */
- lazyCompilation?:
- | boolean
- | {
- /**
- * A custom backend.
- */
- backend?:
- | ((
- compiler: import("../lib/Compiler"),
- client: string,
- callback: (err?: Error, api?: any) => void
- ) => void)
- | ((
- compiler: import("../lib/Compiler"),
- client: string
- ) => Promise);
- /**
- * A custom client.
- */
- client?: string;
- /**
- * Enable/disable lazy compilation for entries.
- */
- entries?: boolean;
- /**
- * Enable/disable lazy compilation for import() modules.
- */
- imports?: boolean;
- /**
- * Specify which entrypoints or import()ed modules should be lazily compiled. This is matched with the imported module and not the entrypoint name.
- */
- test?: RegExp | string | ((module: import("../lib/Module")) => boolean);
- };
- /**
- * Allow output javascript files as module source type.
- */
- outputModule?: boolean;
- /**
- * Support WebAssembly as synchronous EcmaScript Module (outdated).
- */
- syncWebAssembly?: boolean;
- /**
- * Allow using top-level-await in EcmaScript Modules.
- */
- topLevelAwait?: boolean;
-}
/**
* Enable presets of externals for specific targets.
*/
@@ -1184,6 +1263,18 @@ export interface ExternalsPresets {
* Options for infrastructure level logging.
*/
export interface InfrastructureLogging {
+ /**
+ * Only appends lines to the output. Avoids updating existing output e. g. for status messages. This option is only used when no custom console is provided.
+ */
+ appendOnly?: boolean;
+ /**
+ * Enables/Disables colorful output. This option is only used when no custom console is provided.
+ */
+ colors?: boolean;
+ /**
+ * Custom console used for logging.
+ */
+ console?: Console;
/**
* Enable debug logging for specific loggers.
*/
@@ -1192,6 +1283,10 @@ export interface InfrastructureLogging {
* Log level.
*/
level?: "none" | "error" | "warn" | "info" | "log" | "verbose";
+ /**
+ * Stream used for logging output. Defaults to process.stderr. This option is only used when no custom console is provided.
+ */
+ stream?: NodeJS.WritableStream;
}
/**
* Custom values available in the loader context.
@@ -1284,6 +1379,12 @@ export interface ModuleOptions {
* A rule description with conditions and effects for modules.
*/
export interface RuleSetRule {
+ /**
+ * Match on import assertions of the dependency.
+ */
+ assert?: {
+ [k: string]: RuleSetConditionOrConditions;
+ };
/**
* Match the child compiler name.
*/
@@ -1339,7 +1440,7 @@ export interface RuleSetRule {
/**
* Only execute the first matching rule in this array.
*/
- oneOf?: RuleSetRule[];
+ oneOf?: (Falsy | RuleSetRule)[];
/**
* Shortcut for use.options.
*/
@@ -1373,7 +1474,11 @@ export interface RuleSetRule {
/**
* Match and execute these rules when this rule is matched.
*/
- rules?: RuleSetRule[];
+ rules?: (Falsy | RuleSetRule)[];
+ /**
+ * Match module scheme.
+ */
+ scheme?: RuleSetConditionOrConditions;
/**
* Flags a module as with or without side effects.
*/
@@ -1390,6 +1495,46 @@ export interface RuleSetRule {
* Modifiers applied to the module when rule is matched.
*/
use?: RuleSetUse;
+ /**
+ * Match on import attributes of the dependency.
+ */
+ with?: {
+ [k: string]: RuleSetConditionOrConditions;
+ };
+}
+/**
+ * Logic operators used in a condition matcher.
+ */
+export interface RuleSetLogicalConditions {
+ /**
+ * Logical AND.
+ */
+ and?: RuleSetConditions;
+ /**
+ * Logical NOT.
+ */
+ not?: RuleSetCondition;
+ /**
+ * Logical OR.
+ */
+ or?: RuleSetConditions;
+}
+/**
+ * Logic operators used in a condition matcher.
+ */
+export interface RuleSetLogicalConditionsAbsolute {
+ /**
+ * Logical AND.
+ */
+ and?: RuleSetConditionsAbsolute;
+ /**
+ * Logical NOT.
+ */
+ not?: RuleSetConditionAbsolute;
+ /**
+ * Logical OR.
+ */
+ or?: RuleSetConditionsAbsolute;
}
/**
* Options object for resolving requests.
@@ -1442,6 +1587,15 @@ export interface ResolveOptions {
* Field names from the description file (usually package.json) which are used to provide entry points of a package.
*/
exportsFields?: string[];
+ /**
+ * An object which maps extension to extension aliases.
+ */
+ extensionAlias?: {
+ /**
+ * Extension alias.
+ */
+ [k: string]: string[] | string;
+ };
/**
* Extensions added to the request when trying to find the file.
*/
@@ -1477,7 +1631,7 @@ export interface ResolveOptions {
/**
* Plugins for the resolver.
*/
- plugins?: ("..." | ResolvePluginInstance)[];
+ plugins?: ("..." | Falsy | ResolvePluginInstance)[];
/**
* Prefer to resolve server-relative URLs (starting with '/') as absolute paths before falling back to resolve in 'resolve.roots'.
*/
@@ -1515,16 +1669,6 @@ export interface ResolveOptions {
*/
useSyncFileSystemCalls?: boolean;
}
-/**
- * Plugin instance.
- */
-export interface ResolvePluginInstance {
- /**
- * The run point of the plugin, required method.
- */
- apply: (resolver: import("enhanced-resolve").Resolver) => void;
- [k: string]: any;
-}
/**
* Options object for node compatibility features.
*/
@@ -1532,15 +1676,21 @@ export interface NodeOptions {
/**
* Include a polyfill for the '__dirname' variable.
*/
- __dirname?: false | true | "mock" | "eval-only";
+ __dirname?: false | true | "warn-mock" | "mock" | "node-module" | "eval-only";
/**
* Include a polyfill for the '__filename' variable.
*/
- __filename?: false | true | "mock" | "eval-only";
+ __filename?:
+ | false
+ | true
+ | "warn-mock"
+ | "mock"
+ | "node-module"
+ | "eval-only";
/**
* Include a polyfill for the 'global' variable.
*/
- global?: boolean;
+ global?: false | true | "warn";
}
/**
* Enables/Disables integrated optimizations.
@@ -1595,7 +1745,7 @@ export interface Optimization {
/**
* Minimizer(s) to use for minimizing the output.
*/
- minimizer?: ("..." | WebpackPluginInstance | WebpackPluginFunction)[];
+ minimizer?: ("..." | Falsy | WebpackPluginInstance | WebpackPluginFunction)[];
/**
* Define the algorithm to choose module ids (natural: numeric ids in order of usage, named: readable ids for better debugging, hashed: (deprecated) short hashes as ids for better long term caching, deterministic: numeric hash ids for better long term caching, size: numeric ids focused on minimal initial download size, false: no algorithm used, as custom one can be provided via plugin).
*/
@@ -1682,6 +1832,7 @@ export interface OptimizationSplitChunksOptions {
*/
chunks?:
| ("initial" | "async" | "all")
+ | RegExp
| ((chunk: import("../lib/Chunk")) => boolean);
/**
* Sets the size types which are used when a number is used for sizes.
@@ -1699,6 +1850,13 @@ export interface OptimizationSplitChunksOptions {
* Sets the name delimiter for created chunks.
*/
automaticNameDelimiter?: string;
+ /**
+ * Select chunks for determining shared modules (defaults to "async", "initial" and "all" requires adding these chunks to the HTML).
+ */
+ chunks?:
+ | ("initial" | "async" | "all")
+ | RegExp
+ | ((chunk: import("../lib/Chunk")) => boolean);
/**
* Maximal size hint for the on-demand chunks.
*/
@@ -1715,6 +1873,10 @@ export interface OptimizationSplitChunksOptions {
* Minimal size for the created chunk.
*/
minSize?: OptimizationSplitChunksSizes;
+ /**
+ * Minimum size reduction due to the created chunk.
+ */
+ minSizeReduction?: OptimizationSplitChunksSizes;
};
/**
* Sets the template for the filename for created chunks.
@@ -1761,6 +1923,10 @@ export interface OptimizationSplitChunksOptions {
* Minimal size for the created chunks.
*/
minSize?: OptimizationSplitChunksSizes;
+ /**
+ * Minimum size reduction due to the created chunk.
+ */
+ minSizeReduction?: OptimizationSplitChunksSizes;
/**
* Give chunks created a name (chunks with equal name are merged).
*/
@@ -1783,6 +1949,7 @@ export interface OptimizationSplitChunksCacheGroup {
*/
chunks?:
| ("initial" | "async" | "all")
+ | RegExp
| ((chunk: import("../lib/Chunk")) => boolean);
/**
* Ignore minimum size, minimum chunks and maximum requests and always create chunks for this cache group.
@@ -1841,6 +2008,10 @@ export interface OptimizationSplitChunksCacheGroup {
* Minimal size for the created chunk.
*/
minSize?: OptimizationSplitChunksSizes;
+ /**
+ * Minimum size reduction due to the created chunk.
+ */
+ minSizeReduction?: OptimizationSplitChunksSizes;
/**
* Give chunks for this cache group a name (chunks with equal name are merged).
*/
@@ -1870,10 +2041,18 @@ export interface OptimizationSplitChunksCacheGroup {
* Options affecting the output of the compilation. `output` options tell webpack how to write the compiled files to disk.
*/
export interface Output {
+ /**
+ * Add a container for define/require functions in the AMD module.
+ */
+ amdContainer?: AmdContainer;
/**
* The filename of asset modules as relative path inside the 'output.path' directory.
*/
assetModuleFilename?: AssetModuleFilename;
+ /**
+ * Enable/disable creating async chunks that are loaded on demand.
+ */
+ asyncChunks?: boolean;
/**
* Add a comment in the UMD wrapper.
*/
@@ -1887,7 +2066,7 @@ export interface Output {
*/
chunkFilename?: ChunkFilename;
/**
- * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), but others might be added by plugins).
+ * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins).
*/
chunkFormat?: ChunkFormat;
/**
@@ -1895,7 +2074,7 @@ export interface Output {
*/
chunkLoadTimeout?: ChunkLoadTimeout;
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: ChunkLoading;
/**
@@ -1914,6 +2093,18 @@ export interface Output {
* This option enables cross-origin loading of chunks.
*/
crossOriginLoading?: CrossOriginLoading;
+ /**
+ * Specifies the filename template of non-initial output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
+ */
+ cssChunkFilename?: CssChunkFilename;
+ /**
+ * Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
+ */
+ cssFilename?: CssFilename;
+ /**
+ * Compress the data in the head tag of CSS files.
+ */
+ cssHeadDataCompression?: CssHeadDataCompression;
/**
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
*/
@@ -1978,6 +2169,10 @@ export interface Output {
* The filename of the Hot Update Main File. It is inside the 'output.path' directory.
*/
hotUpdateMainFilename?: HotUpdateMainFilename;
+ /**
+ * Ignore warnings in the browser.
+ */
+ ignoreBrowserWarnings?: boolean;
/**
* Wrap javascript code into IIFE's to avoid leaking into global scope.
*/
@@ -1999,7 +2194,7 @@ export interface Output {
*/
libraryExport?: LibraryExport;
/**
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
libraryTarget?: LibraryType;
/**
@@ -2015,7 +2210,7 @@ export interface Output {
*/
pathinfo?: Pathinfo;
/**
- * The `publicPath` specifies the public URL address of the output files when referenced in a browser.
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
*/
publicPath?: PublicPath;
/**
@@ -2038,6 +2233,10 @@ export interface Output {
* Handles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way.
*/
strictModuleExceptionHandling?: StrictModuleExceptionHandling;
+ /**
+ * Use a Trusted Types policy to create urls for chunks. 'output.uniqueName' is used a default policy name. Passing a string sets a custom policy name.
+ */
+ trustedTypes?: true | string | TrustedTypes;
/**
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
*/
@@ -2055,9 +2254,13 @@ export interface Output {
*/
webassemblyModuleFilename?: WebassemblyModuleFilename;
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
workerChunkLoading?: ChunkLoading;
+ /**
+ * Worker public path. Much like the public path, this sets the location where the worker script file is intended to be found. If not set, webpack will use the publicPath. Don't set this option unless your worker scripts are located at a different path from your other script files.
+ */
+ workerPublicPath?: WorkerPublicPath;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
@@ -2084,6 +2287,10 @@ export interface Environment {
* The environment supports arrow functions ('() => { ... }').
*/
arrowFunction?: boolean;
+ /**
+ * The environment supports async function and await ('async function () { await ... }').
+ */
+ asyncFunction?: boolean;
/**
* The environment supports BigInt as literal (123n).
*/
@@ -2096,18 +2303,55 @@ export interface Environment {
* The environment supports destructuring ('{ a, b } = obj').
*/
destructuring?: boolean;
+ /**
+ * The environment supports 'document'.
+ */
+ document?: boolean;
/**
* The environment supports an async import() function to import EcmaScript modules.
*/
dynamicImport?: boolean;
+ /**
+ * The environment supports an async import() is available when creating a worker.
+ */
+ dynamicImportInWorker?: boolean;
/**
* The environment supports 'for of' iteration ('for (const x of array) { ... }').
*/
forOf?: boolean;
+ /**
+ * The environment supports 'globalThis'.
+ */
+ globalThis?: boolean;
/**
* The environment supports EcmaScript Module syntax to import EcmaScript modules (import ... from '...').
*/
module?: boolean;
+ /**
+ * The environment supports `node:` prefix for Node.js core modules.
+ */
+ nodePrefixForCoreModules?: boolean;
+ /**
+ * The environment supports optional chaining ('obj?.a' or 'obj?.()').
+ */
+ optionalChaining?: boolean;
+ /**
+ * The environment supports template literals.
+ */
+ templateLiteral?: boolean;
+}
+/**
+ * Use a Trusted Types policy to create urls for chunks.
+ */
+export interface TrustedTypes {
+ /**
+ * If the call to `trustedTypes.createPolicy(...)` fails -- e.g., due to the policy name missing from the CSP `trusted-types` list, or it being a duplicate name, etc. -- controls whether to continue with loading in the hope that `require-trusted-types-for 'script'` isn't enforced yet, versus fail immediately. Default behavior is 'stop'.
+ */
+ onPolicyCreationFailure?: "continue" | "stop";
+ /**
+ * The name of the Trusted Types policy created by webpack to serve bundle chunks.
+ */
+ policyName?: string;
}
/**
* Configuration object for web performance recommendations.
@@ -2150,11 +2394,11 @@ export interface SnapshotOptions {
/**
* List of paths that are managed by a package manager and contain a version or hash in its path so all files are immutable.
*/
- immutablePaths?: string[];
+ immutablePaths?: (RegExp | string)[];
/**
* List of paths that are managed by a package manager and can be trusted to not be modified otherwise.
*/
- managedPaths?: string[];
+ managedPaths?: (RegExp | string)[];
/**
* Options for snapshotting dependencies of modules to determine if they need to be built again.
*/
@@ -2194,6 +2438,10 @@ export interface SnapshotOptions {
*/
timestamp?: boolean;
};
+ /**
+ * List of paths that are not managed by a package manager and the contents are subject to change.
+ */
+ unmanagedPaths?: (RegExp | string)[];
}
/**
* Stats options object.
@@ -2342,6 +2590,10 @@ export interface StatsOptions {
* Add errors count.
*/
errorsCount?: boolean;
+ /**
+ * Space to display errors (value is in number of lines).
+ */
+ errorsSpace?: number;
/**
* Please use excludeModules instead.
*/
@@ -2394,6 +2646,14 @@ export interface StatsOptions {
* Group modules by their path.
*/
groupModulesByPath?: boolean;
+ /**
+ * Group modules by their type.
+ */
+ groupModulesByType?: boolean;
+ /**
+ * Group reasons by their origin module.
+ */
+ groupReasonsByOrigin?: boolean;
/**
* Add the hash of the compilation.
*/
@@ -2474,6 +2734,10 @@ export interface StatsOptions {
* Add information about the reasons why modules are included.
*/
reasons?: boolean;
+ /**
+ * Space to display reasons (groups will be collapsed to fit this space).
+ */
+ reasonsSpace?: number;
/**
* Add information about assets that are related to other assets (like SourceMaps for assets).
*/
@@ -2514,6 +2778,10 @@ export interface StatsOptions {
* Suppress listing warnings that match the specified filters (they will still be counted). Filters can be Strings, RegExps or Functions.
*/
warningsFilter?: WarningFilterTypes;
+ /**
+ * Space to display warnings (value is in number of lines).
+ */
+ warningsSpace?: number;
}
/**
* Options for the watcher.
@@ -2557,6 +2825,10 @@ export interface AssetGeneratorDataUrlOptions {
* Generator options for asset/inline modules.
*/
export interface AssetInlineGeneratorOptions {
+ /**
+ * Whether or not this asset module should be considered binary. This can be set to 'false' to treat this asset module as text.
+ */
+ binary?: boolean;
/**
* The options for data url generator.
*/
@@ -2584,6 +2856,10 @@ export interface AssetParserOptions {
* Generator options for asset/resource modules.
*/
export interface AssetResourceGeneratorOptions {
+ /**
+ * Whether or not this asset module should be considered binary. This can be set to 'false' to treat this asset module as text.
+ */
+ binary?: boolean;
/**
* Emit an output asset from this asset module. This can be set to 'false' to omit emitting e. g. for SSR.
*/
@@ -2592,6 +2868,126 @@ export interface AssetResourceGeneratorOptions {
* Specifies the filename template of output files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
*/
filename?: FilenameTemplate;
+ /**
+ * Emit the asset in the specified folder relative to 'output.path'. This should only be needed when custom 'publicPath' is specified to match the folder structure there.
+ */
+ outputPath?: AssetModuleOutputPath;
+ /**
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
+ */
+ publicPath?: RawPublicPath;
+}
+/**
+ * Generator options for css/auto modules.
+ */
+export interface CssAutoGeneratorOptions {
+ /**
+ * Configure the generated JS modules that use the ES modules syntax.
+ */
+ esModule?: CssGeneratorEsModule;
+ /**
+ * Specifies the convention of exported names.
+ */
+ exportsConvention?: CssGeneratorExportsConvention;
+ /**
+ * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
+ */
+ exportsOnly?: CssGeneratorExportsOnly;
+ /**
+ * Configure the generated local ident name.
+ */
+ localIdentName?: CssGeneratorLocalIdentName;
+}
+/**
+ * Parser options for css/auto modules.
+ */
+export interface CssAutoParserOptions {
+ /**
+ * Use ES modules named export for css exports.
+ */
+ namedExports?: CssParserNamedExports;
+}
+/**
+ * Generator options for css modules.
+ */
+export interface CssGeneratorOptions {
+ /**
+ * Configure the generated JS modules that use the ES modules syntax.
+ */
+ esModule?: CssGeneratorEsModule;
+ /**
+ * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
+ */
+ exportsOnly?: CssGeneratorExportsOnly;
+}
+/**
+ * Generator options for css/global modules.
+ */
+export interface CssGlobalGeneratorOptions {
+ /**
+ * Configure the generated JS modules that use the ES modules syntax.
+ */
+ esModule?: CssGeneratorEsModule;
+ /**
+ * Specifies the convention of exported names.
+ */
+ exportsConvention?: CssGeneratorExportsConvention;
+ /**
+ * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
+ */
+ exportsOnly?: CssGeneratorExportsOnly;
+ /**
+ * Configure the generated local ident name.
+ */
+ localIdentName?: CssGeneratorLocalIdentName;
+}
+/**
+ * Parser options for css/global modules.
+ */
+export interface CssGlobalParserOptions {
+ /**
+ * Use ES modules named export for css exports.
+ */
+ namedExports?: CssParserNamedExports;
+}
+/**
+ * Generator options for css/module modules.
+ */
+export interface CssModuleGeneratorOptions {
+ /**
+ * Configure the generated JS modules that use the ES modules syntax.
+ */
+ esModule?: CssGeneratorEsModule;
+ /**
+ * Specifies the convention of exported names.
+ */
+ exportsConvention?: CssGeneratorExportsConvention;
+ /**
+ * Avoid generating and loading a stylesheet and only embed exports from css into output javascript files.
+ */
+ exportsOnly?: CssGeneratorExportsOnly;
+ /**
+ * Configure the generated local ident name.
+ */
+ localIdentName?: CssGeneratorLocalIdentName;
+}
+/**
+ * Parser options for css/module modules.
+ */
+export interface CssModuleParserOptions {
+ /**
+ * Use ES modules named export for css exports.
+ */
+ namedExports?: CssParserNamedExports;
+}
+/**
+ * Parser options for css modules.
+ */
+export interface CssParserOptions {
+ /**
+ * Use ES modules named export for css exports.
+ */
+ namedExports?: CssParserNamedExports;
}
/**
* No generator options are supported for this module type.
@@ -2606,7 +3002,15 @@ export interface EmptyParserOptions {}
*/
export interface EntryDescriptionNormalized {
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * Enable/disable creating async chunks that are loaded on demand.
+ */
+ asyncChunks?: boolean;
+ /**
+ * Base uri for this entry.
+ */
+ baseUri?: string;
+ /**
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: ChunkLoading;
/**
@@ -2629,6 +3033,10 @@ export interface EntryDescriptionNormalized {
* Options for library.
*/
library?: LibraryOptions;
+ /**
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
+ */
+ publicPath?: PublicPath;
/**
* The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
*/
@@ -2647,6 +3055,43 @@ export interface EntryStaticNormalized {
*/
[k: string]: EntryDescriptionNormalized;
}
+/**
+ * Enables/Disables experiments (experimental features with relax SemVer compatibility).
+ */
+export interface ExperimentsCommon {
+ /**
+ * Support WebAssembly as asynchronous EcmaScript Module.
+ */
+ asyncWebAssembly?: boolean;
+ /**
+ * Enable backward-compat layer with deprecation warnings for many webpack 4 APIs.
+ */
+ backCompat?: boolean;
+ /**
+ * Enable additional in memory caching of modules that are unchanged and reference only unchanged modules.
+ */
+ cacheUnaffected?: boolean;
+ /**
+ * Apply defaults of next major version.
+ */
+ futureDefaults?: boolean;
+ /**
+ * Enable module layers.
+ */
+ layers?: boolean;
+ /**
+ * Allow output javascript files as module source type.
+ */
+ outputModule?: boolean;
+ /**
+ * Support WebAssembly as synchronous EcmaScript Module (outdated).
+ */
+ syncWebAssembly?: boolean;
+ /**
+ * Allow using top-level-await in EcmaScript Modules.
+ */
+ topLevelAwait?: boolean;
+}
/**
* Data object passed as argument when a function is set for 'externals'.
*/
@@ -2659,6 +3104,10 @@ export interface ExternalItemFunctionData {
* Contextual information.
*/
contextInfo?: import("../lib/ModuleFactory").ModuleFactoryCreateDataContextInfo;
+ /**
+ * The category of the referencing dependencies.
+ */
+ dependencyType?: string;
/**
* Get a resolve function with the current resolver options.
*/
@@ -2676,6 +3125,35 @@ export interface ExternalItemFunctionData {
*/
request?: string;
}
+/**
+ * Options for building http resources.
+ */
+export interface HttpUriOptions {
+ /**
+ * List of allowed URIs (resp. the beginning of them).
+ */
+ allowedUris: HttpUriOptionsAllowedUris;
+ /**
+ * Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
+ */
+ cacheLocation?: false | string;
+ /**
+ * When set, anything that would lead to a modification of the lockfile or any resource content, will result in an error.
+ */
+ frozen?: boolean;
+ /**
+ * Location of the lockfile.
+ */
+ lockfileLocation?: string;
+ /**
+ * Proxy configuration, which can be used to specify a proxy server to use for HTTP requests.
+ */
+ proxy?: string;
+ /**
+ * When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
+ */
+ upgrade?: boolean;
+}
/**
* Parser options for javascript modules.
*/
@@ -2696,6 +3174,30 @@ export interface JavascriptParserOptions {
* Enable/disable parsing of magic comments in CommonJs syntax.
*/
commonjsMagicComments?: boolean;
+ /**
+ * Enable/disable parsing "import { createRequire } from "module"" and evaluating createRequire().
+ */
+ createRequire?: boolean | string;
+ /**
+ * Specifies global fetchPriority for dynamic import.
+ */
+ dynamicImportFetchPriority?: "low" | "high" | "auto" | false;
+ /**
+ * Specifies global mode for dynamic import.
+ */
+ dynamicImportMode?: "eager" | "weak" | "lazy" | "lazy-once";
+ /**
+ * Specifies global prefetch for dynamic import.
+ */
+ dynamicImportPrefetch?: number | boolean;
+ /**
+ * Specifies global preload for dynamic import.
+ */
+ dynamicImportPreload?: number | boolean;
+ /**
+ * Specifies the behavior of invalid export names in "import ... from ..." and "export ... from ...".
+ */
+ exportsPresence?: "error" | "warn" | "auto" | false;
/**
* Enable warnings for full dynamic dependencies.
*/
@@ -2720,10 +3222,30 @@ export interface JavascriptParserOptions {
* Enable/disable parsing of import() syntax.
*/
import?: boolean;
+ /**
+ * Specifies the behavior of invalid export names in "import ... from ...".
+ */
+ importExportsPresence?: "error" | "warn" | "auto" | false;
+ /**
+ * Enable/disable evaluating import.meta.
+ */
+ importMeta?: boolean;
+ /**
+ * Enable/disable evaluating import.meta.webpackContext.
+ */
+ importMetaContext?: boolean;
/**
* Include polyfills or mocks for various node stuff.
*/
node?: Node;
+ /**
+ * Override the module to strict or non-strict. This may affect the behavior of the module (some behaviors differ between strict and non-strict), so please configure this option carefully.
+ */
+ overrideStrict?: "strict" | "non-strict";
+ /**
+ * Specifies the behavior of invalid export names in "export ... from ...". This might be useful to disable during the migration from "export ... from ..." to "export type ... from ..." when reexporting types in TypeScript.
+ */
+ reexportExportsPresence?: "error" | "warn" | "auto" | false;
/**
* Enable/disable parsing of require.context syntax.
*/
@@ -2741,7 +3263,7 @@ export interface JavascriptParserOptions {
*/
requireJs?: boolean;
/**
- * Emit errors instead of warnings when imported names don't exist in imported module.
+ * Deprecated in favor of "exportsPresence". Emit errors instead of warnings when imported names don't exist in imported module.
*/
strictExportPresence?: boolean;
/**
@@ -2790,6 +3312,66 @@ export interface JavascriptParserOptions {
wrappedContextRegExp?: RegExp;
[k: string]: any;
}
+/**
+ * Options for the default backend.
+ */
+export interface LazyCompilationDefaultBackendOptions {
+ /**
+ * A custom client.
+ */
+ client?: string;
+ /**
+ * Specifies where to listen to from the server.
+ */
+ listen?:
+ | number
+ | import("net").ListenOptions
+ | ((server: import("net").Server) => void);
+ /**
+ * Specifies the protocol the client should use to connect to the server.
+ */
+ protocol?: "http" | "https";
+ /**
+ * Specifies how to create the server handling the EventSource requests.
+ */
+ server?:
+ | (import("https").ServerOptions | import("http").ServerOptions)
+ | (() => import("net").Server);
+}
+/**
+ * Options for compiling entrypoints and import()s only when they are accessed.
+ */
+export interface LazyCompilationOptions {
+ /**
+ * Specifies the backend that should be used for handling client keep alive.
+ */
+ backend?:
+ | (
+ | ((
+ compiler: import("../lib/Compiler"),
+ callback: (
+ err?: Error,
+ api?: import("../lib/hmr/LazyCompilationPlugin").BackendApi
+ ) => void
+ ) => void)
+ | ((
+ compiler: import("../lib/Compiler")
+ ) => Promise)
+ )
+ | LazyCompilationDefaultBackendOptions;
+ /**
+ * Enable/disable lazy compilation for entries.
+ */
+ entries?: boolean;
+ /**
+ * Enable/disable lazy compilation for import() modules.
+ */
+ imports?: boolean;
+ /**
+ * Specify which entrypoints or import()ed modules should be lazily compiled. This is matched with the imported module and not the entrypoint name.
+ */
+ test?: RegExp | string | ((module: import("../lib/Module")) => boolean);
+}
/**
* Options affecting the normal modules (`NormalModuleFactory`).
*/
@@ -2827,6 +3409,10 @@ export interface OutputNormalized {
* The filename of asset modules as relative path inside the 'output.path' directory.
*/
assetModuleFilename?: AssetModuleFilename;
+ /**
+ * Enable/disable creating async chunks that are loaded on demand.
+ */
+ asyncChunks?: boolean;
/**
* Add charset attribute for script tag.
*/
@@ -2836,7 +3422,7 @@ export interface OutputNormalized {
*/
chunkFilename?: ChunkFilename;
/**
- * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), but others might be added by plugins).
+ * The format of chunks (formats included by default are 'array-push' (web/WebWorker), 'commonjs' (node.js), 'module' (ESM), but others might be added by plugins).
*/
chunkFormat?: ChunkFormat;
/**
@@ -2844,7 +3430,7 @@ export interface OutputNormalized {
*/
chunkLoadTimeout?: ChunkLoadTimeout;
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
chunkLoading?: ChunkLoading;
/**
@@ -2863,6 +3449,18 @@ export interface OutputNormalized {
* This option enables cross-origin loading of chunks.
*/
crossOriginLoading?: CrossOriginLoading;
+ /**
+ * Specifies the filename template of non-initial output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
+ */
+ cssChunkFilename?: CssChunkFilename;
+ /**
+ * Specifies the filename template of output css files on disk. You must **not** specify an absolute path here, but the path may contain folders separated by '/'! The specified path is joined with the value of the 'output.path' option to determine the location on disk.
+ */
+ cssFilename?: CssFilename;
+ /**
+ * Compress the data in the head tag of CSS files.
+ */
+ cssHeadDataCompression?: CssHeadDataCompression;
/**
* Similar to `output.devtoolModuleFilenameTemplate`, but used in the case of duplicate module identifiers.
*/
@@ -2927,6 +3525,10 @@ export interface OutputNormalized {
* The filename of the Hot Update Main File. It is inside the 'output.path' directory.
*/
hotUpdateMainFilename?: HotUpdateMainFilename;
+ /**
+ * Ignore warnings in the browser.
+ */
+ ignoreBrowserWarnings?: boolean;
/**
* Wrap javascript code into IIFE's to avoid leaking into global scope.
*/
@@ -2956,7 +3558,7 @@ export interface OutputNormalized {
*/
pathinfo?: Pathinfo;
/**
- * The `publicPath` specifies the public URL address of the output files when referenced in a browser.
+ * The 'publicPath' specifies the public URL address of the output files when referenced in a browser.
*/
publicPath?: PublicPath;
/**
@@ -2979,6 +3581,10 @@ export interface OutputNormalized {
* Handles exceptions in module loading correctly at a performance cost (Deprecated). This will handle module error compatible with the Node.js CommonJS way.
*/
strictModuleExceptionHandling?: StrictModuleExceptionHandling;
+ /**
+ * Use a Trusted Types policy to create urls for chunks.
+ */
+ trustedTypes?: TrustedTypes;
/**
* A unique name of the webpack build to avoid multiple webpack runtimes to conflict when using globals.
*/
@@ -2992,9 +3598,13 @@ export interface OutputNormalized {
*/
webassemblyModuleFilename?: WebassemblyModuleFilename;
/**
- * The method of loading chunks (methods included by default are 'jsonp' (web), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
+ * The method of loading chunks (methods included by default are 'jsonp' (web), 'import' (ESM), 'importScripts' (WebWorker), 'require' (sync node.js), 'async-node' (async node.js), but others might be added by plugins).
*/
workerChunkLoading?: ChunkLoading;
+ /**
+ * Worker public path. Much like the public path, this sets the location where the worker script file is intended to be found. If not set, webpack will use the publicPath. Don't set this option unless your worker scripts are located at a different path from your other script files.
+ */
+ workerPublicPath?: WorkerPublicPath;
/**
* The method of loading WebAssembly Modules (methods included by default are 'fetch' (web/WebWorker), 'async-node' (node.js), but others might be added by plugins).
*/
@@ -3039,7 +3649,7 @@ export interface WebpackOptionsNormalized {
/**
* Enables/Disables experiments (experimental features with relax SemVer compatibility).
*/
- experiments: Experiments;
+ experiments: ExperimentsNormalized;
/**
* Specify dependencies that shouldn't be resolved by webpack, but should become dependencies of the resulting bundle. The kind of the dependency depends on `output.libraryTarget`.
*/
@@ -3141,6 +3751,40 @@ export interface WebpackOptionsNormalized {
*/
watchOptions: WatchOptions;
}
+/**
+ * Enables/Disables experiments (experimental features with relax SemVer compatibility).
+ */
+export interface ExperimentsExtra {
+ /**
+ * Build http(s): urls using a lockfile and resource content cache.
+ */
+ buildHttp?: HttpUriAllowedUris | HttpUriOptions;
+ /**
+ * Enable css support.
+ */
+ css?: boolean;
+ /**
+ * Compile entrypoints and import()s only when they are accessed.
+ */
+ lazyCompilation?: boolean | LazyCompilationOptions;
+}
+/**
+ * Enables/Disables experiments (experimental features with relax SemVer compatibility).
+ */
+export interface ExperimentsNormalizedExtra {
+ /**
+ * Build http(s): urls using a lockfile and resource content cache.
+ */
+ buildHttp?: HttpUriOptions;
+ /**
+ * Enable css support.
+ */
+ css?: boolean;
+ /**
+ * Compile entrypoints and import()s only when they are accessed.
+ */
+ lazyCompilation?: false | LazyCompilationOptions;
+}
/**
* If an dependency matches exactly a property of the object, the property value is used as dependency.
*/
@@ -3176,6 +3820,22 @@ export interface GeneratorOptionsByModuleTypeKnown {
* Generator options for asset/resource modules.
*/
"asset/resource"?: AssetResourceGeneratorOptions;
+ /**
+ * Generator options for css modules.
+ */
+ css?: CssGeneratorOptions;
+ /**
+ * Generator options for css/auto modules.
+ */
+ "css/auto"?: CssAutoGeneratorOptions;
+ /**
+ * Generator options for css/global modules.
+ */
+ "css/global"?: CssGlobalGeneratorOptions;
+ /**
+ * Generator options for css/module modules.
+ */
+ "css/module"?: CssModuleGeneratorOptions;
/**
* No generator options are supported for this module type.
*/
@@ -3224,6 +3884,22 @@ export interface ParserOptionsByModuleTypeKnown {
* No parser options are supported for this module type.
*/
"asset/source"?: EmptyParserOptions;
+ /**
+ * Parser options for css modules.
+ */
+ css?: CssParserOptions;
+ /**
+ * Parser options for css/auto modules.
+ */
+ "css/auto"?: CssAutoParserOptions;
+ /**
+ * Parser options for css/global modules.
+ */
+ "css/global"?: CssGlobalParserOptions;
+ /**
+ * Parser options for css/module modules.
+ */
+ "css/module"?: CssModuleParserOptions;
/**
* Parser options for javascript modules.
*/
diff --git a/declarations/_container.d.ts b/declarations/_container.d.ts
deleted file mode 100644
index 912089e9f46..00000000000
--- a/declarations/_container.d.ts
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * This file was automatically generated.
- * DO NOT MODIFY BY HAND.
- * Run `yarn special-lint-fix` to update
- */
-
-/**
- * Modules that should be exposed by this container. When provided, property name is used as public name, otherwise public name is automatically inferred from request.
- */
-export type Exposes = (ExposesItem | ExposesObject)[] | ExposesObject;
-/**
- * Module that should be exposed by this container.
- */
-export type ExposesItem = string;
-/**
- * Modules that should be exposed by this container.
- */
-export type ExposesItems = ExposesItem[];
-/**
- * Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
- */
-export type Remotes = (RemotesItem | RemotesObject)[] | RemotesObject;
-/**
- * Container location from which modules should be resolved and loaded at runtime.
- */
-export type RemotesItem = string;
-/**
- * Container locations from which modules should be resolved and loaded at runtime.
- */
-export type RemotesItems = RemotesItem[];
-
-export interface _Container {
- [k: string]: any;
-}
-/**
- * Modules that should be exposed by this container. Property names are used as public paths.
- */
-export interface ExposesObject {
- /**
- * Modules that should be exposed by this container.
- */
- [k: string]: ExposesConfig | ExposesItem | ExposesItems;
-}
-/**
- * Advanced configuration for modules that should be exposed by this container.
- */
-export interface ExposesConfig {
- /**
- * Request to a module that should be exposed by this container.
- */
- import: ExposesItem | ExposesItems;
- /**
- * Custom chunk name for the exposed module.
- */
- name?: string;
-}
-/**
- * Container locations from which modules should be resolved and loaded at runtime. Property names are used as request scopes.
- */
-export interface RemotesObject {
- /**
- * Container locations from which modules should be resolved and loaded at runtime.
- */
- [k: string]: RemotesConfig | RemotesItem | RemotesItems;
-}
-/**
- * Advanced configuration for container locations from which modules should be resolved and loaded at runtime.
- */
-export interface RemotesConfig {
- /**
- * Container locations from which modules should be resolved and loaded at runtime.
- */
- external: RemotesItem | RemotesItems;
- /**
- * The name of the share scope shared with this remote.
- */
- shareScope?: string;
-}
diff --git a/declarations/_sharing.d.ts b/declarations/_sharing.d.ts
deleted file mode 100644
index 88084d43b35..00000000000
--- a/declarations/_sharing.d.ts
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * This file was automatically generated.
- * DO NOT MODIFY BY HAND.
- * Run `yarn special-lint-fix` to update
- */
-
-/**
- * Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.
- */
-export type Shared = (SharedItem | SharedObject)[] | SharedObject;
-/**
- * A module that should be shared in the share scope.
- */
-export type SharedItem = string;
-
-export interface _Sharing {
- [k: string]: any;
-}
-/**
- * Modules that should be shared in the share scope. Property names are used to match requested modules in this compilation. Relative requests are resolved, module requests are matched unresolved, absolute paths will match resolved requests. A trailing slash will match all requests with this prefix. In this case shareKey must also have a trailing slash.
- */
-export interface SharedObject {
- /**
- * Modules that should be shared in the share scope.
- */
- [k: string]: SharedConfig | SharedItem;
-}
-/**
- * Advanced configuration for modules that should be shared in the share scope.
- */
-export interface SharedConfig {
- /**
- * Include the provided and fallback module directly instead behind an async request. This allows to use this shared module in initial load too. All possible shared modules need to be eager too.
- */
- eager?: boolean;
- /**
- * Provided module that should be provided to share scope. Also acts as fallback module if no shared module is found in share scope or version isn't valid. Defaults to the property name.
- */
- import?: false | SharedItem;
- /**
- * Package name to determine required version from description file. This is only needed when package name can't be automatically determined from request.
- */
- packageName?: string;
- /**
- * Version requirement from module in share scope.
- */
- requiredVersion?: false | string;
- /**
- * Module is looked up under this key from the share scope.
- */
- shareKey?: string;
- /**
- * Share scope name.
- */
- shareScope?: string;
- /**
- * Allow only a single version of the shared module in share scope (disabled by default).
- */
- singleton?: boolean;
- /**
- * Do not accept shared module if version is not valid (defaults to yes, if local fallback module is available and shared module is not a singleton, otherwise no, has no effect if there is no required version specified).
- */
- strictVersion?: boolean;
- /**
- * Version of the provided module. Will replace lower matching versions, but not higher.
- */
- version?: false | string;
-}
diff --git a/declarations/index.d.ts b/declarations/index.d.ts
new file mode 100644
index 00000000000..a9475f0809c
--- /dev/null
+++ b/declarations/index.d.ts
@@ -0,0 +1,9 @@
+export type {
+ LoaderModule,
+ RawLoaderDefinition,
+ LoaderDefinition,
+ LoaderDefinitionFunction,
+ PitchLoaderDefinitionFunction,
+ RawLoaderDefinitionFunction,
+ LoaderContext
+} from "./LoaderContext";
diff --git a/declarations/plugins/BannerPlugin.d.ts b/declarations/plugins/BannerPlugin.d.ts
index 0a4511c376f..d42d50d6576 100644
--- a/declarations/plugins/BannerPlugin.d.ts
+++ b/declarations/plugins/BannerPlugin.d.ts
@@ -12,7 +12,7 @@ export type BannerPluginArgument =
* The banner as function, it will be wrapped in a comment.
*/
export type BannerFunction = (data: {
- hash: string;
+ hash?: string;
chunk: import("../../lib/Chunk");
filename: string;
}) => string;
@@ -38,6 +38,10 @@ export interface BannerPluginOptions {
* Exclude all modules matching any of these conditions.
*/
exclude?: Rules;
+ /**
+ * If true, banner will be placed at the end of the output.
+ */
+ footer?: boolean;
/**
* Include all modules matching any of these conditions.
*/
@@ -46,6 +50,10 @@ export interface BannerPluginOptions {
* If true, banner will not be wrapped in a comment.
*/
raw?: boolean;
+ /**
+ * Specifies the banner.
+ */
+ stage?: number;
/**
* Include all modules that pass test assertion.
*/
diff --git a/declarations/plugins/HashedModuleIdsPlugin.d.ts b/declarations/plugins/HashedModuleIdsPlugin.d.ts
index 931c0bd6036..faea6fb5031 100644
--- a/declarations/plugins/HashedModuleIdsPlugin.d.ts
+++ b/declarations/plugins/HashedModuleIdsPlugin.d.ts
@@ -4,6 +4,11 @@
* Run `yarn special-lint-fix` to update
*/
+/**
+ * Algorithm used for generation the hash (see node.js crypto package).
+ */
+export type HashFunction = string | typeof import("../../lib/util/Hash");
+
export interface HashedModuleIdsPluginOptions {
/**
* The context directory for creating names.
@@ -20,5 +25,5 @@ export interface HashedModuleIdsPluginOptions {
/**
* The hashing algorithm to use, defaults to 'md4'. All functions from Node.JS' crypto.createHash are supported.
*/
- hashFunction?: string;
+ hashFunction?: HashFunction;
}
diff --git a/declarations/plugins/IgnorePlugin.d.ts b/declarations/plugins/IgnorePlugin.d.ts
index e71e3b1e1ff..281504f9f90 100644
--- a/declarations/plugins/IgnorePlugin.d.ts
+++ b/declarations/plugins/IgnorePlugin.d.ts
@@ -13,11 +13,11 @@ export type IgnorePluginOptions =
/**
* A RegExp to test the request against.
*/
- resourceRegExp?: RegExp;
+ resourceRegExp: RegExp;
}
| {
/**
* A filter function for resource and context.
*/
- checkResource?: (resource: string, context: string) => boolean;
+ checkResource: (resource: string, context: string) => boolean;
};
diff --git a/declarations/plugins/SourceMapDevToolPlugin.d.ts b/declarations/plugins/SourceMapDevToolPlugin.d.ts
index c9f8b431c05..e0104874453 100644
--- a/declarations/plugins/SourceMapDevToolPlugin.d.ts
+++ b/declarations/plugins/SourceMapDevToolPlugin.d.ts
@@ -17,7 +17,13 @@ export interface SourceMapDevToolPluginOptions {
/**
* Appends the given value to the original asset. Usually the #sourceMappingURL comment. [url] is replaced with a URL to the source map file. false disables the appending.
*/
- append?: (false | null) | string;
+ append?:
+ | (false | null)
+ | string
+ | ((
+ pathData: import("../../lib/Compilation").PathData,
+ assetInfo?: import("../../lib/Compilation").AssetInfo
+ ) => string);
/**
* Indicates whether column mappings should be used (defaults to true).
*/
diff --git a/declarations/plugins/container/ContainerPlugin.d.ts b/declarations/plugins/container/ContainerPlugin.d.ts
index 3c47757ba41..f0c0608a0cf 100644
--- a/declarations/plugins/container/ContainerPlugin.d.ts
+++ b/declarations/plugins/container/ContainerPlugin.d.ts
@@ -16,6 +16,10 @@ export type ExposesItem = string;
* Modules that should be exposed by this container.
*/
export type ExposesItems = ExposesItem[];
+/**
+ * Add a container for define/require functions in the AMD module.
+ */
+export type AmdContainer = string;
/**
* Add a comment in the UMD wrapper.
*/
@@ -29,7 +33,7 @@ export type LibraryExport = string[] | string;
*/
export type LibraryName = string[] | string | LibraryCustomUmdObject;
/**
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
export type LibraryType =
| (
@@ -44,6 +48,7 @@ export type LibraryType =
| "commonjs"
| "commonjs2"
| "commonjs-module"
+ | "commonjs-static"
| "amd"
| "amd-require"
| "umd"
@@ -56,6 +61,10 @@ export type LibraryType =
* If `output.libraryTarget` is set to umd and `output.library` is set, setting this to true will name the AMD module.
*/
export type UmdNamedDefine = boolean;
+/**
+ * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
+ */
+export type EntryRuntime = false | string;
export interface ContainerPluginOptions {
/**
@@ -74,6 +83,10 @@ export interface ContainerPluginOptions {
* The name for this container.
*/
name: string;
+ /**
+ * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
+ */
+ runtime?: EntryRuntime;
/**
* The name of the share scope which is shared with the host (defaults to 'default').
*/
@@ -105,6 +118,10 @@ export interface ExposesConfig {
* Options for library.
*/
export interface LibraryOptions {
+ /**
+ * Add a container for define/require functions in the AMD module.
+ */
+ amdContainer?: AmdContainer;
/**
* Add a comment in the UMD wrapper.
*/
@@ -118,7 +135,7 @@ export interface LibraryOptions {
*/
name?: LibraryName;
/**
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
type: LibraryType;
/**
diff --git a/declarations/plugins/container/ContainerReferencePlugin.d.ts b/declarations/plugins/container/ContainerReferencePlugin.d.ts
index c81cad2481a..3ac0dbb63d0 100644
--- a/declarations/plugins/container/ContainerReferencePlugin.d.ts
+++ b/declarations/plugins/container/ContainerReferencePlugin.d.ts
@@ -18,6 +18,7 @@ export type ExternalsType =
| "commonjs"
| "commonjs2"
| "commonjs-module"
+ | "commonjs-static"
| "amd"
| "amd-require"
| "umd"
@@ -26,7 +27,9 @@ export type ExternalsType =
| "system"
| "promise"
| "import"
- | "script";
+ | "module-import"
+ | "script"
+ | "node-commonjs";
/**
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
*/
diff --git a/declarations/plugins/container/ModuleFederationPlugin.d.ts b/declarations/plugins/container/ModuleFederationPlugin.d.ts
index 40c9e4f9a61..e2a99e19736 100644
--- a/declarations/plugins/container/ModuleFederationPlugin.d.ts
+++ b/declarations/plugins/container/ModuleFederationPlugin.d.ts
@@ -16,6 +16,10 @@ export type ExposesItem = string;
* Modules that should be exposed by this container.
*/
export type ExposesItems = ExposesItem[];
+/**
+ * Add a container for define/require functions in the AMD module.
+ */
+export type AmdContainer = string;
/**
* Add a comment in the UMD wrapper.
*/
@@ -29,7 +33,7 @@ export type LibraryExport = string[] | string;
*/
export type LibraryName = string[] | string | LibraryCustomUmdObject;
/**
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
export type LibraryType =
| (
@@ -44,6 +48,7 @@ export type LibraryType =
| "commonjs"
| "commonjs2"
| "commonjs-module"
+ | "commonjs-static"
| "amd"
| "amd-require"
| "umd"
@@ -70,6 +75,7 @@ export type ExternalsType =
| "commonjs"
| "commonjs2"
| "commonjs-module"
+ | "commonjs-static"
| "amd"
| "amd-require"
| "umd"
@@ -78,7 +84,9 @@ export type ExternalsType =
| "system"
| "promise"
| "import"
- | "script";
+ | "module-import"
+ | "script"
+ | "node-commonjs";
/**
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
*/
@@ -91,6 +99,10 @@ export type RemotesItem = string;
* Container locations from which modules should be resolved and loaded at runtime.
*/
export type RemotesItems = RemotesItem[];
+/**
+ * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
+ */
+export type EntryRuntime = false | string;
/**
* Modules that should be shared in the share scope. When provided, property names are used to match requested modules in this compilation.
*/
@@ -125,6 +137,10 @@ export interface ModuleFederationPluginOptions {
* Container locations and request scopes from which modules should be resolved and loaded at runtime. When provided, property name is used as request scope, otherwise request scope is automatically inferred from container location.
*/
remotes?: Remotes;
+ /**
+ * The name of the runtime chunk. If set a runtime chunk with this name is created or an existing entrypoint is used as runtime.
+ */
+ runtime?: EntryRuntime;
/**
* Share scope name used for all shared modules (defaults to 'default').
*/
@@ -160,6 +176,10 @@ export interface ExposesConfig {
* Options for library.
*/
export interface LibraryOptions {
+ /**
+ * Add a container for define/require functions in the AMD module.
+ */
+ amdContainer?: AmdContainer;
/**
* Add a comment in the UMD wrapper.
*/
@@ -173,7 +193,7 @@ export interface LibraryOptions {
*/
name?: LibraryName;
/**
- * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
+ * Type of library (types included by default are 'var', 'module', 'assign', 'assign-properties', 'this', 'window', 'self', 'global', 'commonjs', 'commonjs2', 'commonjs-module', 'commonjs-static', 'amd', 'amd-require', 'umd', 'umd2', 'jsonp', 'system', but others might be added by plugins).
*/
type: LibraryType;
/**
diff --git a/declarations/plugins/schemes/HttpUriPlugin.d.ts b/declarations/plugins/schemes/HttpUriPlugin.d.ts
new file mode 100644
index 00000000000..2d0e869831b
--- /dev/null
+++ b/declarations/plugins/schemes/HttpUriPlugin.d.ts
@@ -0,0 +1,45 @@
+/*
+ * This file was automatically generated.
+ * DO NOT MODIFY BY HAND.
+ * Run `yarn special-lint-fix` to update
+ */
+
+export type HttpUriPluginOptions = HttpUriOptions;
+/**
+ * List of allowed URIs (resp. the beginning of them).
+ */
+export type HttpUriOptionsAllowedUris = (
+ | RegExp
+ | string
+ | ((uri: string) => boolean)
+)[];
+
+/**
+ * Options for building http resources.
+ */
+export interface HttpUriOptions {
+ /**
+ * List of allowed URIs (resp. the beginning of them).
+ */
+ allowedUris: HttpUriOptionsAllowedUris;
+ /**
+ * Location where resource content is stored for lockfile entries. It's also possible to disable storing by passing false.
+ */
+ cacheLocation?: false | string;
+ /**
+ * When set, anything that would lead to a modification of the lockfile or any resource content, will result in an error.
+ */
+ frozen?: boolean;
+ /**
+ * Location of the lockfile.
+ */
+ lockfileLocation?: string;
+ /**
+ * Proxy configuration, which can be used to specify a proxy server to use for HTTP requests.
+ */
+ proxy?: string;
+ /**
+ * When set, resources of existing lockfile entries will be fetched and entries will be upgraded when resource content has changed.
+ */
+ upgrade?: boolean;
+}
diff --git a/eslint.config.js b/eslint.config.js
new file mode 100644
index 00000000000..ce34ca4f482
--- /dev/null
+++ b/eslint.config.js
@@ -0,0 +1,432 @@
+const js = require("@eslint/js");
+const prettier = require("eslint-plugin-prettier");
+const n = require("eslint-plugin-n");
+const jest = require("eslint-plugin-jest");
+const jsdoc = require("eslint-plugin-jsdoc");
+const prettierConfig = require("eslint-config-prettier");
+const globals = require("globals");
+const stylistic = require("@stylistic/eslint-plugin");
+const unicorn = require("eslint-plugin-unicorn");
+
+const nodeConfig = n.configs["flat/recommended"];
+const jsdocConfig = jsdoc.configs["flat/recommended-typescript-flavor-error"];
+
+module.exports = [
+ {
+ ignores: [
+ // Ignore some test files
+ "test/**/*.*",
+ "!test/*.js",
+ "!test/**/webpack.config.js",
+ "!test/**/test.config.js",
+ "!test/**/test.filter.js",
+ "test/cases/parsing/es2022/test.filter.js",
+ "!test/**/errors.js",
+ "!test/**/warnings.js",
+ "!test/**/deprecations.js",
+ "!test/helpers/*.*",
+
+ // Ignore some folders
+ "benchmark",
+ "coverage",
+
+ // Ignore generated files
+ "*.check.js",
+
+ // Ignore not supported files
+ "*.d.ts",
+
+ // Ignore precompiled schemas
+ "schemas/**/*.check.js",
+
+ // Auto generation
+ "lib/util/semver.js",
+
+ // Ignore some examples files
+ "examples/**/*.js",
+ "examples/**/*.mjs",
+ "!examples/*/webpack.config.js"
+ ]
+ },
+ {
+ ...js.configs.recommended,
+ languageOptions: {
+ ecmaVersion: 2018,
+ globals: {
+ ...globals.node,
+ ...globals.es2018,
+ WebAssembly: true
+ }
+ },
+ linterOptions: {
+ reportUnusedDisableDirectives: true
+ },
+ rules: {
+ ...js.configs.recommended.rules,
+ "no-template-curly-in-string": "error",
+ "no-caller": "error",
+ "no-control-regex": "off",
+ yoda: "error",
+ eqeqeq: "error",
+ "eol-last": "error",
+ "no-extra-bind": "warn",
+ "no-process-exit": "warn",
+ "no-use-before-define": "off",
+ "no-unused-vars": [
+ "error",
+ {
+ vars: "all",
+ varsIgnorePattern: "^_",
+ args: "none",
+ argsIgnorePattern: "^_",
+ caughtErrors: "all",
+ caughtErrorsIgnorePattern: "^_",
+ ignoreRestSiblings: true
+ }
+ ],
+ "no-inner-declarations": "error",
+ "prefer-const": [
+ "error",
+ {
+ destructuring: "all",
+ ignoreReadBeforeAssign: true
+ }
+ ],
+ "object-shorthand": "error",
+ "no-else-return": "error",
+ "no-lonely-if": "error",
+ "no-undef-init": "error",
+ // Disallow @ts-ignore directive. Use @ts-expect-error instead
+ "no-warning-comments": [
+ "error",
+ { terms: ["@ts-ignore"], location: "start" }
+ ],
+ "no-constructor-return": "error",
+ "symbol-description": "error",
+ "array-callback-return": [
+ "error",
+ {
+ allowImplicit: true
+ }
+ ],
+ "no-promise-executor-return": "error",
+ "no-undef": "error",
+ "guard-for-in": "error",
+ "no-constant-condition": "error",
+ camelcase: [
+ "error",
+ {
+ allow: [
+ "__webpack_require__",
+ "__webpack_public_path__",
+ "__webpack_base_uri__",
+ "__webpack_modules__",
+ "__webpack_chunk_load__",
+ "__non_webpack_require__",
+ "__webpack_nonce__",
+ "__webpack_hash__",
+ "__webpack_chunkname__",
+ "__webpack_get_script_filename__",
+ "__webpack_runtime_id__",
+ "__system_context__",
+ "__webpack_share_scopes__",
+ "__webpack_init_sharing__",
+ "__webpack_require_module__",
+ "_stream_duplex",
+ "_stream_passthrough",
+ "_stream_readable",
+ "_stream_transform",
+ "_stream_writable",
+ "string_decoder"
+ ]
+ }
+ ],
+ "prefer-exponentiation-operator": "error",
+ "no-useless-return": "error",
+ "no-return-assign": "error",
+ "default-case-last": "error",
+ "default-param-last": "error",
+ "dot-notation": "error",
+ "grouped-accessor-pairs": "error",
+ "id-match": [
+ "error",
+ "^[$a-zA-Z_][$a-zA-Z0-9_]*$",
+ {
+ properties: true
+ }
+ ],
+ "no-extra-label": "error",
+ "no-label-var": "error",
+ "no-lone-blocks": "error",
+ "no-multi-str": "error",
+ "no-new-func": "error",
+ "no-unneeded-ternary": ["error", { defaultAssignment: false }],
+ "no-useless-call": "error",
+ "no-useless-concat": "error",
+ "prefer-object-spread": "error",
+ "prefer-regex-literals": "error",
+ "prefer-rest-params": "error",
+ "no-var": "error",
+ "one-var": ["error", "never"],
+ "prefer-template": "error",
+ "no-implicit-coercion": [
+ "error",
+ {
+ boolean: true,
+ number: true,
+ string: true
+ }
+ ],
+ "arrow-body-style": ["error", "as-needed"],
+ "new-cap": [
+ "error",
+ {
+ newIsCapExceptions: [],
+ capIsNewExceptions: ["A", "F", "D", "MODULES_GROUPERS"]
+ }
+ ],
+ "func-style": [
+ "error",
+ "declaration",
+ {
+ allowArrowFunctions: true
+ }
+ ],
+ "no-loop-func": "error",
+ "no-unreachable-loop": "error",
+ "no-unmodified-loop-condition": "error",
+ "prefer-spread": "error",
+ "no-sequences": "error",
+ // TODO Enable
+ "id-length": "off",
+ "prefer-destructuring": "off"
+ }
+ },
+ {
+ plugins: {
+ unicorn
+ },
+ rules: {
+ "unicorn/catch-error-name": [
+ "error",
+ { name: "err", ignore: [/(^_|[0-9]+$)/i] }
+ ],
+ "unicorn/prefer-includes": "error",
+ "unicorn/no-zero-fractions": "error",
+ "unicorn/prefer-string-starts-ends-with": "error",
+ "unicorn/prefer-default-parameters": "error",
+ "unicorn/prefer-negative-index": "error",
+ "unicorn/prefer-ternary": ["error", "only-single-line"],
+ "unicorn/prefer-array-find": "error",
+ "unicorn/no-lonely-if": "error",
+ "unicorn/no-hex-escape": "error",
+ "unicorn/escape-case": "error",
+ "unicorn/no-array-for-each": "error",
+ "unicorn/prefer-number-properties": "error",
+ "unicorn/prefer-native-coercion-functions": "error",
+ // TODO Enable
+ "unicorn/prefer-spread": "off"
+ }
+ },
+ {
+ plugins: {
+ "@stylistic": stylistic
+ },
+ rules: {
+ "@stylistic/lines-between-class-members": "error",
+ "@stylistic/quotes": [
+ "error",
+ "double",
+ { avoidEscape: true, allowTemplateLiterals: false }
+ ],
+ "@stylistic/spaced-comment": [
+ "error",
+ "always",
+ {
+ line: {
+ markers: ["=", "!"], // Space here to support sprockets directives
+ exceptions: ["-", "+"]
+ },
+ block: {
+ markers: ["=", "!"], // Space here to support sprockets directives
+ exceptions: ["-", "+"],
+ balanced: true
+ }
+ }
+ ]
+ }
+ },
+ {
+ ...nodeConfig,
+ rules: {
+ ...nodeConfig.rules,
+ "n/no-missing-require": ["error", { allowModules: ["webpack"] }],
+ "n/no-unsupported-features/node-builtins": [
+ "error",
+ {
+ ignores: ["zlib.createBrotliCompress", "zlib.createBrotliDecompress"]
+ }
+ ],
+ "n/exports-style": "error"
+ }
+ },
+ {
+ ...jsdocConfig,
+ settings: {
+ jsdoc: {
+ mode: "typescript",
+ // supported tags https://github.com/microsoft/TypeScript-wiki/blob/master/JSDoc-support-in-JavaScript.md
+ tagNamePreference: {
+ ...["implements", "const", "memberof", "yields"].reduce(
+ (acc, tag) => {
+ acc[tag] = {
+ message: `@${tag} currently not supported in TypeScript`
+ };
+ return acc;
+ },
+ {}
+ ),
+ extends: "extends",
+ return: "returns",
+ constructor: "constructor",
+ prop: "property",
+ arg: "param",
+ augments: "extends",
+ description: false,
+ desc: false,
+ inheritdoc: false,
+ class: "constructor"
+ },
+ overrideReplacesDocs: false
+ }
+ },
+ rules: {
+ ...jsdocConfig.rules,
+ // Override recommended
+ // TODO remove me after switch to typescript strict mode
+ "jsdoc/require-jsdoc": "off",
+ // Doesn't support function overloading/tuples/`readonly`/module keyword/etc
+ // Also `typescript` reports this itself
+ "jsdoc/valid-types": "off",
+ // A lot of false positive with loops/`switch`/`if`/etc
+ "jsdoc/require-returns-check": "off",
+ // TODO fix and enable in future
+ "jsdoc/require-property-description": "off",
+
+ // More rules
+ "jsdoc/check-indentation": "error",
+ "jsdoc/no-bad-blocks": "error",
+ "jsdoc/require-hyphen-before-param-description": ["error", "never"],
+ "jsdoc/require-template": "error",
+ "jsdoc/no-blank-block-descriptions": "error",
+ "jsdoc/no-blank-blocks": "error",
+ "jsdoc/require-asterisk-prefix": "error"
+ }
+ },
+ {
+ files: ["bin/**/*.js"],
+ // Allow to use `dynamic` import
+ languageOptions: {
+ ecmaVersion: 2020
+ },
+ rules: {
+ "n/no-unsupported-features/es-syntax": [
+ "error",
+ {
+ ignores: ["hashbang", "dynamic-import"]
+ }
+ ]
+ }
+ },
+ {
+ files: ["lib/**/*.runtime.js", "hot/*.js"],
+ languageOptions: {
+ ecmaVersion: 5,
+ globals: {
+ ...globals.browser,
+ ...globals.es5
+ }
+ },
+ rules: {
+ "prefer-const": "off",
+ "object-shorthand": "off",
+ "no-undef-init": "off",
+ "no-var": "off",
+ "n/exports-style": "off",
+ "prefer-template": "off",
+ "no-implicit-coercion": "off",
+ "func-style": "off",
+ "unicorn/prefer-includes": "off",
+ "unicorn/no-useless-undefined": "off",
+ "unicorn/no-array-for-each": "off"
+ }
+ },
+ {
+ files: ["tooling/**/*.js"],
+ languageOptions: {
+ ecmaVersion: 2020,
+ globals: {
+ ...globals.es2020
+ }
+ }
+ },
+ {
+ ...jest.configs["flat/recommended"],
+ files: ["test/**/*.js"],
+ languageOptions: {
+ ecmaVersion: 2020,
+ globals: {
+ ...globals.jest,
+ nsObj: false
+ }
+ },
+ rules: {
+ ...jest.configs["flat/recommended"].rules,
+ "jest/no-standalone-expect": "off",
+ "jest/valid-title": [
+ "error",
+ {
+ ignoreTypeOfDescribeName: true,
+ ignoreTypeOfTestName: true
+ }
+ ],
+ "jest/no-done-callback": "off",
+ "jest/expect-expect": "off",
+ "jest/no-conditional-expect": "off",
+ "n/no-unsupported-features/node-builtins": [
+ "error",
+ {
+ allowExperimental: true
+ }
+ ],
+ "object-shorthand": "off",
+ camelcase: "off",
+ "no-var": "off"
+ }
+ },
+ {
+ files: [
+ "test/configCases/{dll-plugin-entry,dll-plugin-side-effects,dll-plugin}/**/webpack.config.js"
+ ],
+ rules: {
+ "n/no-missing-require": "off"
+ }
+ },
+ {
+ files: ["examples/**/*.js"],
+ rules: {
+ "n/no-missing-require": "off"
+ }
+ },
+ {
+ ...prettierConfig,
+ plugins: {
+ ...prettierConfig.plugins,
+ prettier
+ },
+ rules: {
+ ...prettierConfig.rules,
+ "prettier/prettier": "error"
+ }
+ }
+];
diff --git a/examples/README.md b/examples/README.md
index 0bbade59b91..6e9361f51ef 100644
--- a/examples/README.md
+++ b/examples/README.md
@@ -23,9 +23,10 @@
19. [Scope Hoisting](#scope-hoisting)
20. [Side Effects](#side-effects)
21. [Source Map](#source-map)
-22. [Web Worker](#web-worker)
-23. [Requests](#requests)
-24. [Building an Example](#building-an-example)
+22. [WebAssembly](#webassembly)
+23. [Web Worker](#web-worker)
+24. [Requests](#requests)
+25. [Building an Example](#building-an-example)
## Aggressive Merging
@@ -49,8 +50,6 @@
[two-explicit-vendor-chunks](two-explicit-vendor-chunks)
## Code Splitted
-[code-splitted-css-bundle](code-splitted-css-bundle)
-
[code-splitted-require.context-amd](code-splitted-require.context-amd) example demonstrating contexts in a code-split environment with AMD.
[code-splitted-require.context](code-splitted-require.context) example demonstrating contexts in a code-split environment.
@@ -58,7 +57,7 @@
## Code Splitting
[code-splitting](code-splitting) example demonstrating a very simple case of Code Splitting.
-[code-splitting-bundle-loader](code-splitting-bundle-loader) example demonstrating Code Splitting through the builder loader
+[code-splitting-bundle-loader](code-splitting-bundle-loader) example demonstrating Code Splitting through the bundle loader
[code-splitting-harmony](code-splitting-harmony)
@@ -130,6 +129,10 @@
## Source Map
[source-map](source-map)
+## WebAssembly
+[wasm-simple](wasm-simple) example demonstrating simple import from a WebAssembly module
+[wasm-complex](wasm-complex) example demonstrating top-level await and import of WebAssembly text format with wast-loader
+
## Web Worker
[web-worker](worker) example demonstrating creating WebWorkers with webpack.
diff --git a/examples/aggressive-merging/README.md b/examples/aggressive-merging/README.md
index 1b3e91e4731..959c4632409 100644
--- a/examples/aggressive-merging/README.md
+++ b/examples/aggressive-merging/README.md
@@ -60,9 +60,9 @@ module.exports = {
## Unoptimized
```
-asset pageA.bundle.js 8.91 KiB [emitted] (name: pageA)
-asset pageB.bundle.js 8.91 KiB [emitted] (name: pageB)
-asset pageC.bundle.js 8.91 KiB [emitted] (name: pageC)
+asset pageA.bundle.js 8.9 KiB [emitted] (name: pageA)
+asset pageB.bundle.js 8.9 KiB [emitted] (name: pageB)
+asset pageC.bundle.js 8.9 KiB [emitted] (name: pageC)
asset 456.chunk.js 6.28 KiB [emitted]
asset 394.chunk.js 606 bytes [emitted]
chunk (runtime: pageB) pageB.bundle.js (pageB) 69 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered]
@@ -113,15 +113,15 @@ chunk (runtime: pageA, pageB) 456.chunk.js 5.45 KiB [rendered]
cjs self exports reference ./common.js 1:0-14
amd require ./common ./pageA.js 1:0-3:2
amd require ./common ./pageB.js 1:0-3:2
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset pageC.bundle.js 1.73 KiB [emitted] [minimized] (name: pageC)
-asset pageA.bundle.js 1.72 KiB [emitted] [minimized] (name: pageA)
-asset pageB.bundle.js 1.72 KiB [emitted] [minimized] (name: pageB)
+asset pageC.bundle.js 1.74 KiB [emitted] [minimized] (name: pageC)
+asset pageA.bundle.js 1.73 KiB [emitted] [minimized] (name: pageA)
+asset pageB.bundle.js 1.73 KiB [emitted] [minimized] (name: pageB)
asset 456.chunk.js 155 bytes [emitted] [minimized]
asset 394.chunk.js 104 bytes [emitted] [minimized]
chunk (runtime: pageB) pageB.bundle.js (pageB) 69 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered]
@@ -172,5 +172,5 @@ chunk (runtime: pageA, pageB) 456.chunk.js 5.45 KiB [rendered]
cjs self exports reference ./common.js 1:0-14
amd require ./common ./pageA.js 1:0-3:2
amd require ./common ./pageB.js 1:0-3:2
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/aggressive-merging/webpack.config.js b/examples/aggressive-merging/webpack.config.js
index 2887ce355e8..b4b6e38eec1 100644
--- a/examples/aggressive-merging/webpack.config.js
+++ b/examples/aggressive-merging/webpack.config.js
@@ -1,5 +1,5 @@
-var path = require("path");
-var { AggressiveMergingPlugin } = require("../../").optimize;
+const path = require("path");
+const { AggressiveMergingPlugin } = require("../..").optimize;
module.exports = {
// mode: "development" || "production",
diff --git a/examples/asset-advanced/README.md b/examples/asset-advanced/README.md
index 73e519639c2..6210a32cafe 100644
--- a/examples/asset-advanced/README.md
+++ b/examples/asset-advanced/README.md
@@ -74,48 +74,7 @@ module.exports = {
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
-/* 0 */
-/*!********************!*\
- !*** ./example.js ***!
- \********************/
-/*! namespace exports */
-/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.svg */ 1);
-
-
-const container = document.createElement("div");
-Object.assign(container.style, {
- display: "flex",
- justifyContent: "center"
-});
-document.body.appendChild(container);
-
-function createImageElement(title, src) {
- const div = document.createElement("div");
- div.style.textAlign = "center";
-
- const h2 = document.createElement("h2");
- h2.textContent = title;
- div.appendChild(h2);
-
- const img = document.createElement("img");
- img.setAttribute("src", src);
- img.setAttribute("width", "150");
- div.appendChild(img);
-
- container.appendChild(div);
-}
-
-[_images_file_svg__WEBPACK_IMPORTED_MODULE_0__].forEach(src => {
- createImageElement(src.split(".").pop(), src);
-});
-
-
-/***/ }),
+/* 0 */,
/* 1 */
/*!*************************!*\
!*** ./images/file.svg ***!
@@ -141,8 +100,9 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e"
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -176,10 +136,48 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e"
``` js
-/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
-/******/ // This entry module used 'exports' so it can't be inlined
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+(() => {
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.svg */ 1);
+
+
+const container = document.createElement("div");
+Object.assign(container.style, {
+ display: "flex",
+ justifyContent: "center"
+});
+document.body.appendChild(container);
+
+function createImageElement(title, src) {
+ const div = document.createElement("div");
+ div.style.textAlign = "center";
+
+ const h2 = document.createElement("h2");
+ h2.textContent = title;
+ div.appendChild(h2);
+
+ const img = document.createElement("img");
+ img.setAttribute("src", src);
+ img.setAttribute("width", "150");
+ div.appendChild(img);
+
+ container.appendChild(div);
+}
+
+[_images_file_svg__WEBPACK_IMPORTED_MODULE_0__].forEach(src => {
+ createImageElement(src.split(".").pop(), src);
+});
+
+})();
+
/******/ })()
;
```
@@ -189,7 +187,7 @@ module.exports = "data:image/svg+xml,%3csvg xmlns='http://www.w3.or...3c/svg%3e"
## webpack output
```
-asset output.js 3.86 KiB [emitted] (name: main)
+asset output.js 3.81 KiB [emitted] (name: main)
chunk (runtime: main) output.js (main) 1.54 KiB (javascript) 274 bytes (runtime) [entry] [rendered]
> ./example.js main
dependent modules 915 bytes [dependent] 1 module
@@ -198,5 +196,5 @@ chunk (runtime: main) output.js (main) 1.54 KiB (javascript) 274 bytes (runtime)
[no exports]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/asset-simple/README.md b/examples/asset-simple/README.md
index 0841a580c8e..c2f5e4c477e 100644
--- a/examples/asset-simple/README.md
+++ b/examples/asset-simple/README.md
@@ -61,59 +61,14 @@ module.exports = {
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
-/* 0 */
-/*!********************!*\
- !*** ./example.js ***!
- \********************/
-/*! namespace exports */
-/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _images_file_png__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.png */ 1);
-/* harmony import */ var _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./images/file.jpg */ 2);
-/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./images/file.svg */ 3);
-
-
-
-
-const container = document.createElement("div");
-Object.assign(container.style, {
- display: "flex",
- justifyContent: "center"
-});
-document.body.appendChild(container);
-
-function createImageElement(title, src) {
- const div = document.createElement("div");
- div.style.textAlign = "center";
-
- const h2 = document.createElement("h2");
- h2.textContent = title;
- div.appendChild(h2);
-
- const img = document.createElement("img");
- img.setAttribute("src", src);
- img.setAttribute("width", "150");
- div.appendChild(img);
-
- container.appendChild(div);
-}
-
-[_images_file_png__WEBPACK_IMPORTED_MODULE_0__, _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__, _images_file_svg__WEBPACK_IMPORTED_MODULE_2__].forEach(src => {
- createImageElement(src.split(".").pop(), src);
-});
-
-
-/***/ }),
+/* 0 */,
/* 1 */
/*!*************************!*\
!*** ./images/file.png ***!
\*************************/
/*! default exports */
/*! exports [not provided] [no usage info] */
-/*! runtime requirements: module, __webpack_require__.p, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__.p, module, __webpack_require__.* */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
module.exports = __webpack_require__.p + "images/89a353e9c515885abd8e.png";
@@ -156,8 +111,9 @@ module.exports = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo...vc3ZnPgo="
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -196,10 +152,52 @@ module.exports = "data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDo...vc3ZnPgo="
``` js
-/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
-/******/ // This entry module used 'exports' so it can't be inlined
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+(() => {
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _images_file_png__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./images/file.png */ 1);
+/* harmony import */ var _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./images/file.jpg */ 2);
+/* harmony import */ var _images_file_svg__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./images/file.svg */ 3);
+
+
+
+
+const container = document.createElement("div");
+Object.assign(container.style, {
+ display: "flex",
+ justifyContent: "center"
+});
+document.body.appendChild(container);
+
+function createImageElement(title, src) {
+ const div = document.createElement("div");
+ div.style.textAlign = "center";
+
+ const h2 = document.createElement("h2");
+ h2.textContent = title;
+ div.appendChild(h2);
+
+ const img = document.createElement("img");
+ img.setAttribute("src", src);
+ img.setAttribute("width", "150");
+ div.appendChild(img);
+
+ container.appendChild(div);
+}
+
+[_images_file_png__WEBPACK_IMPORTED_MODULE_0__, _images_file_jpg__WEBPACK_IMPORTED_MODULE_1__, _images_file_svg__WEBPACK_IMPORTED_MODULE_2__].forEach(src => {
+ createImageElement(src.split(".").pop(), src);
+});
+
+})();
+
/******/ })()
;
```
@@ -219,5 +217,5 @@ chunk (runtime: main) output.js (main) 9.58 KiB (javascript) 14.6 KiB (asset) 30
[no exports]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/build-common.js b/examples/build-common.js
index 41d554c3b06..7293b32d604 100644
--- a/examples/build-common.js
+++ b/examples/build-common.js
@@ -16,7 +16,8 @@ const targetArgs = global.NO_TARGET_ARGS ? "" : "--entry ./example.js --output-f
const displayReasons = global.NO_REASONS ? "" : "--stats-reasons --stats-used-exports --stats-provided-exports";
const statsArgs = global.NO_STATS_OPTIONS ? "" : "--stats-chunks --stats-modules-space 99999 --stats-chunk-origins";
const publicPathArgs = global.NO_PUBLIC_PATH ? "" : '--output-public-path "dist/"';
-const commonArgs = `--no-stats-colors ${statsArgs} ${publicPathArgs} ${extraArgs} ${targetArgs}`;
+const statsColorsArg = global.STATS_COLORS ? "" : "--no-stats-colors";
+const commonArgs = `${statsColorsArg} ${statsArgs} ${publicPathArgs} ${extraArgs} ${targetArgs}`;
let readme = fs.readFileSync(require("path").join(process.cwd(), "template.md"), "utf-8");
@@ -50,7 +51,30 @@ const doCompileAndReplace = (args, prefix, callback) => {
throw new Error("Please install webpack-cli at root.");
}
- cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${args} ${displayReasons} ${commonArgs}`, (error, stdout, stderr) => {
+ const connectIO = (subprocess) => {
+ const { stdin, stdout, stderr } = process;
+ const { stdin: _stdin, stdout: _stdout, stderr: _stderr } = subprocess;
+ const inputPair = [[stdin, _stdin]];
+ const outputPair = [[stdout, _stdout], [stderr, _stderr]];
+ inputPair.forEach(pair => {
+ pair[0].pipe(pair[1])
+ })
+ outputPair.forEach(pair => {
+ pair[1].pipe(pair[0])
+ })
+ disconnectIO = () => {
+ inputPair.forEach(pair => {
+ pair[0].unpipe(pair[1])
+ })
+ outputPair.forEach(pair => {
+ pair[1].unpipe(pair[0])
+ })
+ }
+ }
+ let disconnectIO = null;
+
+ const subprocess = cp.exec(`node ${path.resolve(__dirname, "../bin/webpack.js")} ${args} ${displayReasons} ${commonArgs}`, (error, stdout, stderr) => {
+ disconnectIO && disconnectIO();
if (stderr)
console.log(stderr);
if (error !== null)
@@ -63,6 +87,7 @@ const doCompileAndReplace = (args, prefix, callback) => {
}
callback();
});
+ connectIO(subprocess);
};
async.series([
diff --git a/examples/build-http/README.md b/examples/build-http/README.md
new file mode 100644
index 00000000000..088ca7e5a01
--- /dev/null
+++ b/examples/build-http/README.md
@@ -0,0 +1,92 @@
+# example.js
+
+```javascript
+import pMap1 from "https://cdn.skypack.dev/p-map";
+import pMap2 from "https://cdn.esm.sh/p-map";
+import pMap3 from "https://jspm.dev/p-map";
+import pMap4 from "https://unpkg.com/p-map-series?module"; // unpkg doesn't support p-map :(
+console.log(pMap1);
+console.log(pMap2);
+console.log(pMap3);
+console.log(pMap4);
+```
+
+# webpack.config.js
+
+```javascript
+module.exports = {
+ // enable debug logging to see network requests!
+ // stats: {
+ // loggingDebug: /HttpUriPlugin/
+ // },
+ experiments: {
+ buildHttp: [
+ "https://cdn.esm.sh/",
+ "https://cdn.skypack.dev/",
+ "https://jspm.dev/",
+ /^https:\/\/unpkg\.com\/.+\?module$/
+ ]
+ }
+};
+```
+
+# Info
+
+## Unoptimized
+
+```
+asset output.js 82.6 KiB [emitted] (name: main)
+runtime modules 670 bytes 3 modules
+modules by path https:// 30 KiB
+ modules by path https://jspm.dev/ 16.1 KiB 12 modules
+ modules by path https://cdn.esm.sh/ 6.15 KiB
+ https://cdn.esm.sh/p-map 173 bytes [built] [code generated]
+ [exports: default, pMapSkip]
+ [used exports unknown]
+ harmony side effect evaluation https://cdn.esm.sh/p-map ./example.js 2:0-45
+ harmony import specifier https://cdn.esm.sh/p-map ./example.js 6:12-17
+ https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js 1.18 KiB [built] [code generated]
+ [exports: default, pMapSkip]
+ [used exports unknown]
+ harmony side effect evaluation https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js https://cdn.esm.sh/p-map 2:0-67
+ harmony export imported specifier https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js https://cdn.esm.sh/p-map 2:0-67
+ harmony side effect evaluation https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js https://cdn.esm.sh/p-map 3:0-77
+ harmony export imported specifier https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js https://cdn.esm.sh/p-map 3:0-77
+ + 5 modules
+ modules by path https://cdn.skypack.dev/ 7.46 KiB
+ https://cdn.skypack.dev/p-map 757 bytes [built] [code generated]
+ [exports: default, pMapSkip]
+ [used exports unknown]
+ harmony side effect evaluation https://cdn.skypack.dev/p-map ./example.js 1:0-50
+ harmony import specifier https://cdn.skypack.dev/p-map ./example.js 5:12-17
+ https://cdn.skypack.dev/-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js 2.29 KiB [built] [code generated]
+ [exports: default, pMapSkip]
+ [used exports unknown]
+ harmony side effect evaluation /-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js https://cdn.skypack.dev/p-map 15:0-97
+ harmony export imported specifier /-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js https://cdn.skypack.dev/p-map 15:0-97
+ harmony side effect evaluation /-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js https://cdn.skypack.dev/p-map 16:0-105
+ harmony export imported specifier /-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js https://cdn.skypack.dev/p-map 16:0-105
+ + 4 modules
+ https://unpkg.com/p-map-series?module 263 bytes [built] [code generated]
+ [exports: default]
+ [used exports unknown]
+ harmony side effect evaluation https://unpkg.com/p-map-series?module ./example.js 4:0-58
+ harmony import specifier https://unpkg.com/p-map-series?module ./example.js 8:12-17
+./example.js 314 bytes [built] [code generated]
+ [no exports]
+ [used exports unknown]
+ entry ./example.js main
+webpack 5.78.0 compiled successfully
+```
+
+## Production mode
+
+```
+asset output.js 12.4 KiB [emitted] [minimized] (name: main)
+orphan modules 30 KiB [orphan] 26 modules
+./example.js + 25 modules 30.2 KiB [built] [code generated]
+ [no exports]
+ [no exports used]
+ entry ./example.js main
+webpack 5.78.0 compiled successfully
+```
diff --git a/examples/build-http/build.js b/examples/build-http/build.js
new file mode 100644
index 00000000000..1d8b07db18b
--- /dev/null
+++ b/examples/build-http/build.js
@@ -0,0 +1,2 @@
+global.NO_STATS_OPTIONS = true;
+require("../build-common");
diff --git a/examples/build-http/example.js b/examples/build-http/example.js
new file mode 100644
index 00000000000..4dd7204b019
--- /dev/null
+++ b/examples/build-http/example.js
@@ -0,0 +1,8 @@
+import pMap1 from "https://cdn.skypack.dev/p-map";
+import pMap2 from "https://cdn.esm.sh/p-map";
+import pMap3 from "https://jspm.dev/p-map";
+import pMap4 from "https://unpkg.com/p-map-series?module"; // unpkg doesn't support p-map :(
+console.log(pMap1);
+console.log(pMap2);
+console.log(pMap3);
+console.log(pMap4);
diff --git a/examples/build-http/template.md b/examples/build-http/template.md
new file mode 100644
index 00000000000..2df3585bde6
--- /dev/null
+++ b/examples/build-http/template.md
@@ -0,0 +1,25 @@
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# webpack.config.js
+
+```javascript
+_{{webpack.config.js}}_
+```
+
+# Info
+
+## Unoptimized
+
+```
+_{{stdout}}_
+```
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/build-http/webpack.config.js b/examples/build-http/webpack.config.js
new file mode 100644
index 00000000000..ca271913b30
--- /dev/null
+++ b/examples/build-http/webpack.config.js
@@ -0,0 +1,14 @@
+module.exports = {
+ // enable debug logging to see network requests!
+ // stats: {
+ // loggingDebug: /HttpUriPlugin/
+ // },
+ experiments: {
+ buildHttp: [
+ "https://cdn.esm.sh/",
+ "https://cdn.skypack.dev/",
+ "https://jspm.dev/",
+ /^https:\/\/unpkg\.com\/.+\?module$/
+ ]
+ }
+};
diff --git a/examples/build-http/webpack.lock b/examples/build-http/webpack.lock
new file mode 100644
index 00000000000..f696523fd3e
--- /dev/null
+++ b/examples/build-http/webpack.lock
@@ -0,0 +1,29 @@
+{
+ "https://cdn.esm.sh/p-map": { "integrity": "sha512-TfztRxlC5elIRa7x3oz4bfhtxJr5hIhoa+bliQkroNj8haEMPp1mv/eAsfzBt032G1oK6JT6y3135FP0vRh13Q==", "contentType": "application/javascript; charset=utf-8" },
+ "https://cdn.esm.sh/v53/aggregate-error@4.0.0/es2015/aggregate-error.js": { "integrity": "sha512-4iHvwySJO0Dn0aenl2XY1XCGEoMZFaJ+PkuO8Op0BRVNwHiZaKrCuMnPZqUblPhvAG2o8SEA4JdB/fhS3IQZLg==", "contentType": "application/javascript" },
+ "https://cdn.esm.sh/v53/clean-stack@4.1.0/es2015/clean-stack.js": { "integrity": "sha512-VzcwF50IxKsmW4O2DpY8WB6TmYh9caBctTqA2EkE3p9K8JjITMD/qBNqfVmUKAlmq4CFgI3c0xegzMf1BRWbyQ==", "contentType": "application/javascript" },
+ "https://cdn.esm.sh/v53/escape-string-regexp@5.0.0/es2015/escape-string-regexp.js": { "integrity": "sha512-vst7rz+jFlvZMjo5GUzNBSq7QvFoaqOQ+hDq0m40ZJYGts6ptt+QKLZOMDWgoEq3Fabnhiy+hsoIfaHMmVdbSQ==", "contentType": "application/javascript" },
+ "https://cdn.esm.sh/v53/indent-string@5.0.0/es2015/indent-string.js": { "integrity": "sha512-o1hDF1EyRTCiDpcxD2i0XpIuHCMFrc9XkKrkMISIaiWpJdKU7HBRhtqXfBcpVfJF1uNAFJ7/1v40vpPH2r7X8w==", "contentType": "application/javascript" },
+ "https://cdn.esm.sh/v53/os-browserify@0.3.0/es2015/browser.js": { "integrity": "sha512-8JOZWkDGX6WNFtXIk/aOawVo35LZSIgCdbMrleK4QL8kHcYti2oTjfqfn99AJm6SOUsTt0uY5K808uHAvVe3eA==", "contentType": "application/javascript" },
+ "https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js": { "integrity": "sha512-3kEIICBOLKnEn6SNNixOBy+VGgwh0DYtn07yxHfagwiSJV8om7q/37RdHVbQ2pol8B/6oVMHo7Y6YYhmpYKDUA==", "contentType": "application/javascript" },
+ "https://cdn.skypack.dev/-/aggregate-error@v4.0.0-rCH8s5R9g4kQQ807o58j/dist=es2020,mode=imports/optimized/aggregate-error.js": { "integrity": "sha512-E5rN3mgPTqyfHSovQ++ZyZWQkMUniuyjbeHHX+E4G3MStEx6TfObScB8tfHeIyuawSp86nVsFfMZjCruD61rdg==", "contentType": "application/javascript; charset=utf-8" },
+ "https://cdn.skypack.dev/-/clean-stack@v4.1.0-DgWUKXHVzThBBZtsHXhC/dist=es2020,mode=imports/optimized/clean-stack.js": { "integrity": "sha512-1nEMT4Vc2YLu3EbeBnck7Traj0/D6G9MMSGraGpsoQIMKVuhQjq4gP76X6RxUn5GoiHv90KfrFMSWlbBn26Dhw==", "contentType": "application/javascript; charset=utf-8" },
+ "https://cdn.skypack.dev/-/escape-string-regexp@v5.0.0-SUDdAhYOdAgXIYndxZss/dist=es2020,mode=imports/optimized/escape-string-regexp.js": { "integrity": "sha512-54oHYow5obgsKb0twQZMNLvCH2tV5MCOY4YHB0LQH+zVonIAn7JYZseUPWhC3MMkJFK5EkeNWDAX7P2camp27g==", "contentType": "application/javascript; charset=utf-8" },
+ "https://cdn.skypack.dev/-/indent-string@v5.0.0-VgKPSgi4hUX5NbF4n3aC/dist=es2020,mode=imports/optimized/indent-string.js": { "integrity": "sha512-lSZAs06jEHkVlPMEeMtKbygGhrSmJUMVmpB6/2ChdG2F0694vRU1v6N12bUyqR5uGbbteTJ7atP5PmPtTVmlcw==", "contentType": "application/javascript; charset=utf-8" },
+ "https://cdn.skypack.dev/-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js": { "integrity": "sha512-mZyhNJe8VlqEqafSkUGTooFrKcQPSwVjB3UxAAPqywSFD+age77uTRP6ul8uAMEQ3lllmengXX1q45igRxRcDw==", "contentType": "application/javascript; charset=utf-8" },
+ "https://cdn.skypack.dev/p-map": { "integrity": "sha512-FFu6R9j8mrGqTvw8WL37XsWhI9P65XdPD9Jfs/47jiYNdex12f0XJNsIy+fI81PbOkCuEQRgm2nf0P76ieBlag==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:@jspm/core@2.0.0-beta.11/nodelibs/os": { "integrity": "sha512-Jsg9UMzfNTnlPDu6FeftYzdp6XULJwLDI7xFSzULhMqjQUoOIHJhkAToEgr3NnEKCkLZQMIPuBvHAn0ud6gT+w==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:@jspm/core@2.0.0-beta.11/nodelibs/process": { "integrity": "sha512-KIYEmkrnT7TL5EKA5coPbbdoqfL2twHFBVXKTZS+PU5aZFX90yELxZHrm4DhxSQ33FLAWo51/nQLQmqGekWNMw==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:@jspm/core@2/nodelibs/os": { "integrity": "sha512-g2ppEW1AVdbIpc486D0ZmLIR5CtzMITkBwqoBgxvhiIq5/qHP4/unZ7Czk3q8A1UwdTI4wbGzRWndXAUa4/Q0Q==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:aggregate-error@4": { "integrity": "sha512-XfXd6EZ09/SKLmWFFvjPCSkqv0E08IxKc8mFm9mePyLIiEiGyAKokeFt1wql+kG8ikGmI7YqKBsDf07/I31VvA==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:aggregate-error@4.0.0": { "integrity": "sha512-HEobsVYXVCp5H4Z+6qAlKno8XAJwHQrfF4ivR4PHrp4ttM0Yg0zDfOcsjqJOnTP5hEnKR1K6OzQdPfR2r9of4g==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:clean-stack@4": { "integrity": "sha512-3wh/QTJY4tw/GInIcn5I+0hsHSirJi8Tf3kmH85hzQsuwB5k2lghBFZyKZPO7/Ql3muvZeDgN02pYkZap59Qrw==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:clean-stack@4.1.0": { "integrity": "sha512-VgNMH/ju9thH4YuxxA5trzs0u66nzRZhMa43jkhk8q6jxlEBhd7G6ZZxswy2a0ZXiXjPQVhzXfFkAIkY/pxTOg==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:escape-string-regexp@5.0.0": { "integrity": "sha512-Hz7n4npzwf0UgkdjQvLN2HxudnAzllTEM9AzJPlnzf9ktGhkwlFltPQBjEM3xyDHeTj1xI1nYpBSRVQmMCl6bw==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:indent-string@5": { "integrity": "sha512-hjMQ8+LX0q8xe2sCp/DEBJW2MrVFbiDv20pK0PWwENkYCkRlyP5L4t5AUiXLEXfJLUhTVrUfZtf+hmrnGJB/zA==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:indent-string@5.0.0": { "integrity": "sha512-1KRJ7I1gDWWBAXz+NpwQnlJXDiSpaxaftugln1zHywLbqhA/akcZYM6+nTdfSSuQ7wiVong69R5X9l/QKWqO7g==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/npm:p-map@5.1.0": { "integrity": "sha512-Ml4ozElyzZEvq3G61nmeDVjEPVbjNzhWwIfvVcEr0OsUu58yT/ieSJWr6VSSHbNGY8B1IYjJCEO2zFrgIT9plQ==", "contentType": "application/javascript; charset=utf-8" },
+ "https://jspm.dev/p-map": { "integrity": "sha512-Ztuu37YpSElOGm1OnAmLzhgTuTSyeDXCudBO94yRDDicb2zwUTIDEaVnHMJ6Gb7AVnKk26uubHB+Hw0XxKRnrw==", "contentType": "application/javascript; charset=utf-8" },
+ "https://unpkg.com/p-map-series?module": { "resolved": "https://unpkg.com/p-map-series@3.0.0/index.js?module", "integrity": "sha512-e68FFGx6Hb3/2x4o16EWcd6rdmyiov0OLjPnj2bmc60JrrNowav76umw0Gc5TmT+UOjaJo9Xk2lTGQT1/Y6Jug==", "contentType": "application/javascript; charset=utf-8" },
+ "version": 1
+}
diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9dd32c023fd5f3d3e7f2 b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9dd32c023fd5f3d3e7f2
new file mode 100644
index 00000000000..5034fb3895a
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/p-map_9dd32c023fd5f3d3e7f2
@@ -0,0 +1,3 @@
+/* esm.sh - p-map@5.1.0 */
+export * from "https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js";
+export { default } from "https://cdn.esm.sh/v53/p-map@5.1.0/es2015/p-map.js";
diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_aggregate-error_4.0.0_es2015_aggregate-error_ff6bcc1ba33bf3b1810a.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_aggregate-error_4.0.0_es2015_aggregate-error_ff6bcc1ba33bf3b1810a.js
new file mode 100644
index 00000000000..7d5f29fd065
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_aggregate-error_4.0.0_es2015_aggregate-error_ff6bcc1ba33bf3b1810a.js
@@ -0,0 +1,4 @@
+/* esm.sh - esbuild bundle(aggregate-error@4.0.0) es2015 production */
+var l=Object.defineProperty;var f=(n,t,e)=>t in n?l(n,t,{enumerable:!0,configurable:!0,writable:!0,value:e}):n[t]=e;var s=(n,t,e)=>(f(n,typeof t!="symbol"?t+"":t,e),e),i=(n,t,e)=>{if(!t.has(n))throw TypeError("Cannot "+e)};var c=(n,t,e)=>(i(n,t,"read from private field"),e?e.call(n):t.get(n)),g=(n,t,e)=>{if(t.has(n))throw TypeError("Cannot add the same private member more than once");t instanceof WeakSet?t.add(n):t.set(n,e)},o=(n,t,e,a)=>(i(n,t,"write to private field"),a?a.call(n,e):t.set(n,e),e);import u from"/v53/indent-string@5.0.0/es2015/indent-string.js";import m from"/v53/clean-stack@4.1.0/es2015/clean-stack.js";var d=n=>n.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g,""),r,p=class extends Error{constructor(t){if(!Array.isArray(t))throw new TypeError(`Expected input to be an Array, got ${typeof t}`);t=t.map(a=>a instanceof Error?a:a!==null&&typeof a=="object"?Object.assign(new Error(a.message),a):new Error(a));let e=t.map(a=>typeof a.stack=="string"?d(m(a.stack)):String(a)).join(`
+`);e=`
+`+u(e,4);super(e);g(this,r,void 0);s(this,"name","AggregateError");o(this,r,t)}get errors(){return c(this,r).slice()}};r=new WeakMap;export{p as default};
diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_clean-stack_4.1.0_es2015_clean-stack_87b32b37ae264a8e8a1c.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_clean-stack_4.1.0_es2015_clean-stack_87b32b37ae264a8e8a1c.js
new file mode 100644
index 00000000000..a3c644a1fb2
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_clean-stack_4.1.0_es2015_clean-stack_87b32b37ae264a8e8a1c.js
@@ -0,0 +1,4 @@
+/* esm.sh - esbuild bundle(clean-stack@4.1.0) es2015 production */
+import s from"/v53/os-browserify@0.3.0/es2015/browser.js";import i from"/v53/escape-string-regexp@5.0.0/es2015/escape-string-regexp.js";var p=/\s+at.*[(\s](.*)\)?/,l=/^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/,f=typeof s.homedir=="undefined"?"":s.homedir().replace(/\\/g,"/");function u(n,{pretty:c=!1,basePath:a}={}){let o=a&&new RegExp(`(at | \\()${i(a.replace(/\\/g,"/"))}`,"g");if(typeof n=="string")return n.replace(/\\/g,"/").split(`
+`).filter(e=>{let r=e.match(p);if(r===null||!r[1])return!0;let t=r[1];return t.includes(".app/Contents/Resources/electron.asar")||t.includes(".app/Contents/Resources/default_app.asar")?!1:!l.test(t)}).filter(e=>e.trim()!=="").map(e=>(o&&(e=e.replace(o,"$1")),c&&(e=e.replace(p,(r,t)=>r.replace(t,t.replace(f,"~")))),e)).join(`
+`)}export{u as default};
diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_escape-string-regexp_5.0.0_es2015_escape-string-regexp_2c814e466860133eca86.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_escape-string-regexp_5.0.0_es2015_escape-string-regexp_2c814e466860133eca86.js
new file mode 100644
index 00000000000..a70aa3b9a9e
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_escape-string-regexp_5.0.0_es2015_escape-string-regexp_2c814e466860133eca86.js
@@ -0,0 +1,2 @@
+/* esm.sh - esbuild bundle(escape-string-regexp@5.0.0) es2015 production */
+function r(e){if(typeof e!="string")throw new TypeError("Expected a string");return e.replace(/[|\\{}()[\]^$+*?.]/g,"\\$&").replace(/-/g,"\\x2d")}export{r as default};
diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_indent-string_5.0.0_es2015_indent-string_171b2b5ba89965a085b6.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_indent-string_5.0.0_es2015_indent-string_171b2b5ba89965a085b6.js
new file mode 100644
index 00000000000..758f021c33e
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_indent-string_5.0.0_es2015_indent-string_171b2b5ba89965a085b6.js
@@ -0,0 +1,2 @@
+/* esm.sh - esbuild bundle(indent-string@5.0.0) es2015 production */
+function i(t,e=1,o={}){let{indent:r=" ",includeEmptyLines:n=!1}=o;if(typeof t!="string")throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof t}\``);if(typeof e!="number")throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof e}\``);if(e<0)throw new RangeError(`Expected \`count\` to be at least 0, got \`${e}\``);if(typeof r!="string")throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof r}\``);if(e===0)return t;let p=n?/^/gm:/^(?!\s*$)/gm;return t.replace(p,r.repeat(e))}export{i as default};
diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_os-browserify_0.3.0_es2015_browser_476a088316baaea08336.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_os-browserify_0.3.0_es2015_browser_476a088316baaea08336.js
new file mode 100644
index 00000000000..951e12edff7
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_os-browserify_0.3.0_es2015_browser_476a088316baaea08336.js
@@ -0,0 +1,3 @@
+/* esm.sh - esbuild bundle(os-browserify@0.3.0/browser) es2015 production */
+var f=Object.create;var o=Object.defineProperty;var s=Object.getOwnPropertyDescriptor;var m=Object.getOwnPropertyNames;var c=Object.getPrototypeOf,p=Object.prototype.hasOwnProperty;var d=e=>o(e,"__esModule",{value:!0});var l=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports);var w=(e,t,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let n of m(t))!p.call(e,n)&&n!=="default"&&o(e,n,{get:()=>t[n],enumerable:!(i=s(t,n))||i.enumerable});return e},a=e=>w(d(o(e!=null?f(c(e)):{},"default",e&&e.__esModule&&"default"in e?{get:()=>e.default,enumerable:!0}:{value:e,enumerable:!0})),e);var u=l(r=>{r.endianness=function(){return"LE"};r.hostname=function(){return typeof location!="undefined"?location.hostname:""};r.loadavg=function(){return[]};r.uptime=function(){return 0};r.freemem=function(){return Number.MAX_VALUE};r.totalmem=function(){return Number.MAX_VALUE};r.cpus=function(){return[]};r.type=function(){return"Browser"};r.release=function(){return typeof navigator!="undefined"?navigator.appVersion:""};r.networkInterfaces=r.getNetworkInterfaces=function(){return{}};r.arch=function(){return"javascript"};r.platform=function(){return"browser"};r.tmpdir=r.tmpDir=function(){return"/tmp"};r.EOL=`
+`;r.homedir=function(){return"/"}});var b=a(u()),h=a(u()),{endianness:v,hostname:E,loadavg:L,uptime:k,freemem:A,totalmem:I,cpus:N,type:_,release:V,networkInterfaces:x,getNetworkInterfaces:D,arch:M,platform:O,tmpdir:U,tmpDir:X,EOL:j,homedir:B}=b;var export_default=h.default;export{j as EOL,M as arch,N as cpus,export_default as default,v as endianness,A as freemem,D as getNetworkInterfaces,B as homedir,E as hostname,L as loadavg,x as networkInterfaces,O as platform,V as release,X as tmpDir,U as tmpdir,I as totalmem,_ as type,k as uptime};
diff --git a/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_p-map_5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_p-map_5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js
new file mode 100644
index 00000000000..8baf6a8521d
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.esm.sh/v53_p-map_5.1.0_es2015_p-map_cd0c09542673ea9d78f0.js
@@ -0,0 +1,2 @@
+/* esm.sh - esbuild bundle(p-map@5.1.0) es2015 production */
+var g=(l,s,e)=>new Promise((f,x)=>{var N=t=>{try{n(e.next(t))}catch(r){x(r)}},p=t=>{try{n(e.throw(t))}catch(r){x(r)}},n=t=>t.done?f(t.value):Promise.resolve(t.value).then(N,p);n((e=e.apply(l,s)).next())});import y from"/v53/aggregate-error@4.0.0/es2015/aggregate-error.js";function S(x,N){return g(this,arguments,function*(l,s,{concurrency:e=Number.POSITIVE_INFINITY,stopOnError:f=!0}={}){return new Promise((p,n)=>{if(typeof s!="function")throw new TypeError("Mapper function is required");if(!((Number.isSafeInteger(e)||e===Number.POSITIVE_INFINITY)&&e>=1))throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${e}\` (${typeof e})`);let t=[],r=[],m=[],h=l[Symbol.iterator](),u=!1,c=!1,a=0,b=0,I=()=>{if(u)return;let i=h.next(),d=b;if(b++,i.done){if(c=!0,a===0)if(!f&&r.length>0)n(new y(r));else{for(let o of m)t.splice(o,1);p(t)}return}a++,(()=>g(this,null,function*(){try{let o=yield i.value;if(u)return;let w=yield s(o,d);w===T?m.push(d):t[d]=w,a--,I()}catch(o){f?(u=!0,n(o)):(r.push(o),a--,I())}}))()};for(let i=0;i {
+ if (typeof key !== "symbol")
+ key += "";
+ if (key in obj)
+ return __defProp(obj, key, {enumerable: true, configurable: true, writable: true, value});
+ return obj[key] = value;
+};
+var __accessCheck = (obj, member, msg) => {
+ if (!member.has(obj))
+ throw TypeError("Cannot " + msg);
+};
+var __privateGet = (obj, member, getter) => {
+ __accessCheck(obj, member, "read from private field");
+ return getter ? getter.call(obj) : member.get(obj);
+};
+var __privateSet = (obj, member, value, setter) => {
+ __accessCheck(obj, member, "write to private field");
+ setter ? setter.call(obj, value) : member.set(obj, value);
+ return value;
+};
+var _errors;
+import indentString from "/-/indent-string@v5.0.0-VgKPSgi4hUX5NbF4n3aC/dist=es2020,mode=imports/optimized/indent-string.js";
+import cleanStack from "/-/clean-stack@v4.1.0-DgWUKXHVzThBBZtsHXhC/dist=es2020,mode=imports/optimized/clean-stack.js";
+const cleanInternalStack = (stack) => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, "");
+class AggregateError extends Error {
+ constructor(errors) {
+ _errors.set(this, void 0);
+ __publicField(this, "name", "AggregateError");
+ if (!Array.isArray(errors)) {
+ throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
+ }
+ errors = errors.map((error) => {
+ if (error instanceof Error) {
+ return error;
+ }
+ if (error !== null && typeof error === "object") {
+ return Object.assign(new Error(error.message), error);
+ }
+ return new Error(error);
+ });
+ let message = errors.map((error) => {
+ return typeof error.stack === "string" ? cleanInternalStack(cleanStack(error.stack)) : String(error);
+ }).join("\n");
+ message = "\n" + indentString(message, 4);
+ super(message);
+ __privateSet(this, _errors, errors);
+ }
+ get errors() {
+ return __privateGet(this, _errors).slice();
+ }
+}
+_errors = new WeakMap();
+export default AggregateError;
diff --git a/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/clean-stack_v4.1.0-DgWUKXHVzThBBZtsHXhC_dist_es2020_mode_imports_optimized_clean-stack_25e0e8c6773c790b5bc1.js b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/clean-stack_v4.1.0-DgWUKXHVzThBBZtsHXhC_dist_es2020_mode_imports_optimized_clean-stack_25e0e8c6773c790b5bc1.js
new file mode 100644
index 00000000000..d8afc7bdf1c
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/clean-stack_v4.1.0-DgWUKXHVzThBBZtsHXhC_dist_es2020_mode_imports_optimized_clean-stack_25e0e8c6773c790b5bc1.js
@@ -0,0 +1,31 @@
+import escapeStringRegexp from "/-/escape-string-regexp@v5.0.0-SUDdAhYOdAgXIYndxZss/dist=es2020,mode=imports/optimized/escape-string-regexp.js";
+var os = {};
+const extractPathRegex = /\s+at.*[(\s](.*)\)?/;
+const pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
+const homeDir = typeof os.homedir === "undefined" ? "" : os.homedir().replace(/\\/g, "/");
+function cleanStack(stack, {pretty = false, basePath} = {}) {
+ const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath.replace(/\\/g, "/"))}`, "g");
+ if (typeof stack !== "string") {
+ return void 0;
+ }
+ return stack.replace(/\\/g, "/").split("\n").filter((line) => {
+ const pathMatches = line.match(extractPathRegex);
+ if (pathMatches === null || !pathMatches[1]) {
+ return true;
+ }
+ const match = pathMatches[1];
+ if (match.includes(".app/Contents/Resources/electron.asar") || match.includes(".app/Contents/Resources/default_app.asar")) {
+ return false;
+ }
+ return !pathRegex.test(match);
+ }).filter((line) => line.trim() !== "").map((line) => {
+ if (basePathRegex) {
+ line = line.replace(basePathRegex, "$1");
+ }
+ if (pretty) {
+ line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, "~")));
+ }
+ return line;
+ }).join("\n");
+}
+export default cleanStack;
diff --git a/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/escape-string-regexp_v5.0.0-SUDdAhYOdAgXIYndxZss_dist_es2020_mode_imports_optimized_escape-string-regexp_95a4ae8a862c0536f335.js b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/escape-string-regexp_v5.0.0-SUDdAhYOdAgXIYndxZss_dist_es2020_mode_imports_optimized_escape-string-regexp_95a4ae8a862c0536f335.js
new file mode 100644
index 00000000000..d0aaf2eea76
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/escape-string-regexp_v5.0.0-SUDdAhYOdAgXIYndxZss_dist_es2020_mode_imports_optimized_escape-string-regexp_95a4ae8a862c0536f335.js
@@ -0,0 +1,7 @@
+function escapeStringRegexp(string) {
+ if (typeof string !== "string") {
+ throw new TypeError("Expected a string");
+ }
+ return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
+}
+export default escapeStringRegexp;
diff --git a/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/indent-string_v5.0.0-VgKPSgi4hUX5NbF4n3aC_dist_es2020_mode_imports_optimized_indent-string_c9ee21b059896b4e6290.js b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/indent-string_v5.0.0-VgKPSgi4hUX5NbF4n3aC_dist_es2020_mode_imports_optimized_indent-string_c9ee21b059896b4e6290.js
new file mode 100644
index 00000000000..307e1901ff0
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/indent-string_v5.0.0-VgKPSgi4hUX5NbF4n3aC_dist_es2020_mode_imports_optimized_indent-string_c9ee21b059896b4e6290.js
@@ -0,0 +1,24 @@
+function indentString(string, count = 1, options = {}) {
+ const {
+ indent = " ",
+ includeEmptyLines = false
+ } = options;
+ if (typeof string !== "string") {
+ throw new TypeError(`Expected \`input\` to be a \`string\`, got \`${typeof string}\``);
+ }
+ if (typeof count !== "number") {
+ throw new TypeError(`Expected \`count\` to be a \`number\`, got \`${typeof count}\``);
+ }
+ if (count < 0) {
+ throw new RangeError(`Expected \`count\` to be at least 0, got \`${count}\``);
+ }
+ if (typeof indent !== "string") {
+ throw new TypeError(`Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``);
+ }
+ if (count === 0) {
+ return string;
+ }
+ const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
+ return string.replace(regex, indent.repeat(count));
+}
+export default indentString;
diff --git a/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/p-map_85ed609042d47e169edd b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/p-map_85ed609042d47e169edd
new file mode 100644
index 00000000000..aca926092c6
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/p-map_85ed609042d47e169edd
@@ -0,0 +1,16 @@
+/*
+ * Skypack CDN - p-map@5.1.0
+ *
+ * Learn more:
+ * ๐ Package Documentation: https://www.skypack.dev/view/p-map
+ * ๐ Skypack Documentation: https://www.skypack.dev/docs
+ *
+ * Pinned URL: (Optimized for Production)
+ * โถ๏ธ Normal: https://cdn.skypack.dev/pin/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/mode=imports/optimized/p-map.js
+ * โฉ Minified: https://cdn.skypack.dev/pin/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/mode=imports,min/optimized/p-map.js
+ *
+ */
+
+// Browser-Optimized Imports (Don't directly import the URLs below in your application!)
+export * from '/-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js';
+export {default} from '/-/p-map@v5.1.0-7ixXvZxXPKKt9unR9LT0/dist=es2020,mode=imports/optimized/p-map.js';
diff --git a/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/p-map_v5.1.0-7ixXvZxXPKKt9unR9LT0_dist_es2020_mode_imports_optimized_p-map_ddf2a76b117954d701e6.js b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/p-map_v5.1.0-7ixXvZxXPKKt9unR9LT0_dist_es2020_mode_imports_optimized_p-map_ddf2a76b117954d701e6.js
new file mode 100644
index 00000000000..921f352df03
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_cdn.skypack.dev/p-map_v5.1.0-7ixXvZxXPKKt9unR9LT0_dist_es2020_mode_imports_optimized_p-map_ddf2a76b117954d701e6.js
@@ -0,0 +1,79 @@
+import AggregateError from "/-/aggregate-error@v4.0.0-rCH8s5R9g4kQQ807o58j/dist=es2020,mode=imports/optimized/aggregate-error.js";
+async function pMap(iterable, mapper, {
+ concurrency = Number.POSITIVE_INFINITY,
+ stopOnError = true
+} = {}) {
+ return new Promise((resolve, reject) => {
+ if (typeof mapper !== "function") {
+ throw new TypeError("Mapper function is required");
+ }
+ if (!((Number.isSafeInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency >= 1)) {
+ throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
+ }
+ const result = [];
+ const errors = [];
+ const skippedIndexes = [];
+ const iterator = iterable[Symbol.iterator]();
+ let isRejected = false;
+ let isIterableDone = false;
+ let resolvingCount = 0;
+ let currentIndex = 0;
+ const next = () => {
+ if (isRejected) {
+ return;
+ }
+ const nextItem = iterator.next();
+ const index = currentIndex;
+ currentIndex++;
+ if (nextItem.done) {
+ isIterableDone = true;
+ if (resolvingCount === 0) {
+ if (!stopOnError && errors.length > 0) {
+ reject(new AggregateError(errors));
+ } else {
+ for (const skippedIndex of skippedIndexes) {
+ result.splice(skippedIndex, 1);
+ }
+ resolve(result);
+ }
+ }
+ return;
+ }
+ resolvingCount++;
+ (async () => {
+ try {
+ const element = await nextItem.value;
+ if (isRejected) {
+ return;
+ }
+ const value = await mapper(element, index);
+ if (value === pMapSkip) {
+ skippedIndexes.push(index);
+ } else {
+ result[index] = value;
+ }
+ resolvingCount--;
+ next();
+ } catch (error) {
+ if (stopOnError) {
+ isRejected = true;
+ reject(error);
+ } else {
+ errors.push(error);
+ resolvingCount--;
+ next();
+ }
+ }
+ })();
+ };
+ for (let index = 0; index < concurrency; index++) {
+ next();
+ if (isIterableDone) {
+ break;
+ }
+ }
+ });
+}
+const pMapSkip = Symbol("skip");
+export default pMap;
+export {pMapSkip};
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_aggregate-error_4.0_50f751f77af91e405af4.0 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_aggregate-error_4.0_50f751f77af91e405af4.0
new file mode 100644
index 00000000000..65063d10575
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_aggregate-error_4.0_50f751f77af91e405af4.0
@@ -0,0 +1,48 @@
+import indentString from './npm:indent-string@5';
+import cleanStack from './npm:clean-stack@4';
+
+const cleanInternalStack = stack => stack.replace(/\s+at .*aggregate-error\/index.js:\d+:\d+\)?/g, '');
+
+class AggregateError extends Error {
+ #errors;
+
+ name = 'AggregateError';
+
+ constructor(errors) {
+ if (!Array.isArray(errors)) {
+ throw new TypeError(`Expected input to be an Array, got ${typeof errors}`);
+ }
+
+ errors = errors.map(error => {
+ if (error instanceof Error) {
+ return error;
+ }
+
+ if (error !== null && typeof error === 'object') {
+ // Handle plain error objects with message property and/or possibly other metadata
+ return Object.assign(new Error(error.message), error);
+ }
+
+ return new Error(error);
+ });
+
+ let message = errors
+ .map(error => {
+ // The `stack` property is not standardized, so we can't assume it exists
+ return typeof error.stack === 'string' ? cleanInternalStack(cleanStack(error.stack)) : String(error);
+ })
+ .join('\n');
+ message = '\n' + indentString(message, 4);
+ super(message);
+
+ this.#errors = errors;
+ }
+
+ get errors() {
+ return this.#errors.slice();
+ }
+}
+
+export default AggregateError;
+
+//# sourceMappingURL=npm:aggregate-error@4.0.0.map
\ No newline at end of file
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_aggregate-error_4_a354b9220c6e41b430f0 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_aggregate-error_4_a354b9220c6e41b430f0
new file mode 100644
index 00000000000..511f78a97ed
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_aggregate-error_4_a354b9220c6e41b430f0
@@ -0,0 +1,3 @@
+import "/npm:indent-string@5";
+import "/npm:clean-stack@4";
+export { default } from "/npm:aggregate-error@4.0.0";
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_clean-stack_4.1_b2805ba009abd32b0160.0 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_clean-stack_4.1_b2805ba009abd32b0160.0
new file mode 100644
index 00000000000..8d14e04d2a0
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_clean-stack_4.1_b2805ba009abd32b0160.0
@@ -0,0 +1,52 @@
+import os from './npm:@jspm/core@2/nodelibs/os';
+import escapeStringRegexp from './npm:escape-string-regexp@5.0.0';
+
+const extractPathRegex = /\s+at.*[(\s](.*)\)?/;
+const pathRegex = /^(?:(?:(?:node|node:[\w/]+|(?:(?:node:)?internal\/[\w/]*|.*node_modules\/(?:babel-polyfill|pirates)\/.*)?\w+)(?:\.js)?:\d+:\d+)|native)/;
+const homeDir = typeof os.homedir === 'undefined' ? '' : os.homedir().replace(/\\/g, '/');
+
+function cleanStack(stack, {pretty = false, basePath} = {}) {
+ const basePathRegex = basePath && new RegExp(`(at | \\()${escapeStringRegexp(basePath.replace(/\\/g, '/'))}`, 'g');
+
+ if (typeof stack !== 'string') {
+ return undefined;
+ }
+
+ return stack.replace(/\\/g, '/')
+ .split('\n')
+ .filter(line => {
+ const pathMatches = line.match(extractPathRegex);
+ if (pathMatches === null || !pathMatches[1]) {
+ return true;
+ }
+
+ const match = pathMatches[1];
+
+ // Electron
+ if (
+ match.includes('.app/Contents/Resources/electron.asar') ||
+ match.includes('.app/Contents/Resources/default_app.asar')
+ ) {
+ return false;
+ }
+
+ return !pathRegex.test(match);
+ })
+ .filter(line => line.trim() !== '')
+ .map(line => {
+ if (basePathRegex) {
+ line = line.replace(basePathRegex, '$1');
+ }
+
+ if (pretty) {
+ line = line.replace(extractPathRegex, (m, p1) => m.replace(p1, p1.replace(homeDir, '~')));
+ }
+
+ return line;
+ })
+ .join('\n');
+}
+
+export default cleanStack;
+
+//# sourceMappingURL=npm:clean-stack@4.1.0.map
\ No newline at end of file
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_clean-stack_4_760ca83301f78911741b b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_clean-stack_4_760ca83301f78911741b
new file mode 100644
index 00000000000..256472ccdd7
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_clean-stack_4_760ca83301f78911741b
@@ -0,0 +1,3 @@
+import "/npm:@jspm/core@2/nodelibs/os";
+import "/npm:escape-string-regexp@5.0.0";
+export { default } from "/npm:clean-stack@4.1.0";
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_escape-string-regexp_5.0_703470061c4748c30ba2.0 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_escape-string-regexp_5.0_703470061c4748c30ba2.0
new file mode 100644
index 00000000000..3e1c303b111
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_escape-string-regexp_5.0_703470061c4748c30ba2.0
@@ -0,0 +1,15 @@
+function escapeStringRegexp(string) {
+ if (typeof string !== 'string') {
+ throw new TypeError('Expected a string');
+ }
+
+ // Escape characters with special meaning either inside or outside character sets.
+ // Use a simple backslash escape when itโs always valid, and a `\xnn` escape when the simpler form would be disallowed by Unicode patternsโ stricter grammar.
+ return string
+ .replace(/[|\\{}()[\]^$+*?.]/g, '\\$&')
+ .replace(/-/g, '\\x2d');
+}
+
+export default escapeStringRegexp;
+
+//# sourceMappingURL=npm:escape-string-regexp@5.0.0.map
\ No newline at end of file
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_indent-string_5.0_39c50c3c56a92bbf73ba.0 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_indent-string_5.0_39c50c3c56a92bbf73ba.0
new file mode 100644
index 00000000000..f4ccda81d23
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_indent-string_5.0_39c50c3c56a92bbf73ba.0
@@ -0,0 +1,42 @@
+function indentString(string, count = 1, options = {}) {
+ const {
+ indent = ' ',
+ includeEmptyLines = false
+ } = options;
+
+ if (typeof string !== 'string') {
+ throw new TypeError(
+ `Expected \`input\` to be a \`string\`, got \`${typeof string}\``
+ );
+ }
+
+ if (typeof count !== 'number') {
+ throw new TypeError(
+ `Expected \`count\` to be a \`number\`, got \`${typeof count}\``
+ );
+ }
+
+ if (count < 0) {
+ throw new RangeError(
+ `Expected \`count\` to be at least 0, got \`${count}\``
+ );
+ }
+
+ if (typeof indent !== 'string') {
+ throw new TypeError(
+ `Expected \`options.indent\` to be a \`string\`, got \`${typeof indent}\``
+ );
+ }
+
+ if (count === 0) {
+ return string;
+ }
+
+ const regex = includeEmptyLines ? /^/gm : /^(?!\s*$)/gm;
+
+ return string.replace(regex, indent.repeat(count));
+}
+
+export default indentString;
+
+//# sourceMappingURL=npm:indent-string@5.0.0.map
\ No newline at end of file
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_indent-string_5_01a4f4bd5c5dc36ce1b7 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_indent-string_5_01a4f4bd5c5dc36ce1b7
new file mode 100644
index 00000000000..f8b9348076a
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_indent-string_5_01a4f4bd5c5dc36ce1b7
@@ -0,0 +1 @@
+export { default } from "/npm:indent-string@5.0.0";
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_12b8110471722e74fcb6.11_nodelibs_process b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_12b8110471722e74fcb6.11_nodelibs_process
new file mode 100644
index 00000000000..203f79bb446
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_12b8110471722e74fcb6.11_nodelibs_process
@@ -0,0 +1,277 @@
+function unimplemented(name) {
+ throw new Error('Node.js process ' + name + ' is not supported by JSPM core outside of Node.js');
+}
+
+var queue = [];
+var draining = false;
+var currentQueue;
+var queueIndex = -1;
+
+function cleanUpNextTick() {
+ if (!draining || !currentQueue)
+ return;
+ draining = false;
+ if (currentQueue.length) {
+ queue = currentQueue.concat(queue);
+ }
+ else {
+ queueIndex = -1;
+ }
+ if (queue.length)
+ drainQueue();
+}
+
+function drainQueue() {
+ if (draining)
+ return;
+ var timeout = setTimeout(cleanUpNextTick, 0);
+ draining = true;
+
+ var len = queue.length;
+ while(len) {
+ currentQueue = queue;
+ queue = [];
+ while (++queueIndex < len) {
+ if (currentQueue)
+ currentQueue[queueIndex].run();
+ }
+ queueIndex = -1;
+ len = queue.length;
+ }
+ currentQueue = null;
+ draining = false;
+ clearTimeout(timeout);
+}
+
+function nextTick (fun) {
+ var args = new Array(arguments.length - 1);
+ if (arguments.length > 1) {
+ for (var i = 1; i < arguments.length; i++)
+ args[i - 1] = arguments[i];
+ }
+ queue.push(new Item(fun, args));
+ if (queue.length === 1 && !draining)
+ setTimeout(drainQueue, 0);
+}
+// v8 likes predictible objects
+function Item(fun, array) {
+ this.fun = fun;
+ this.array = array;
+}
+Item.prototype.run = function () {
+ this.fun.apply(null, this.array);
+};
+
+var title = 'browser';
+var arch = 'x64';
+var platform = 'browser';
+var env = {
+ PATH: '/usr/bin',
+ LANG: navigator.language + '.UTF-8',
+ PWD: '/',
+ HOME: '/home',
+ TMP: '/tmp',
+};
+var argv = ['/usr/bin/node'];
+var execArgv = [];
+var version = 'v16.8.0';
+var versions = { node: '16.8.0' };
+
+var emitWarning = function(message, type) {
+ console.warn((type ? (type + ': ') : '') + message);
+};
+
+var binding = function(name) { unimplemented('binding'); };
+
+var umask = function(mask) { return 0; };
+
+var cwd = function() { return '/'; };
+var chdir = function(dir) {};
+
+var release = {
+ name: 'node',
+ sourceUrl: '',
+ headersUrl: '',
+ libUrl: '',
+};
+
+function noop() {}
+
+var _rawDebug = noop;
+var moduleLoadList = [];
+function _linkedBinding(name) { unimplemented('_linkedBinding'); }
+var domain = {};
+var _exiting = false;
+var config = {};
+function dlopen(name) { unimplemented('dlopen'); }
+function _getActiveRequests() { return []; }
+function _getActiveHandles() { return []; }
+var reallyExit = noop;
+var _kill = noop;
+var cpuUsage = function() { return {}; };
+var resourceUsage = cpuUsage;
+var memoryUsage = cpuUsage;
+var kill = noop;
+var exit = noop;
+var openStdin = noop;
+var allowedNodeEnvironmentFlags = {};
+function assert(condition, message) {
+ if (!condition) throw new Error(message || 'assertion error');
+}
+var features = {
+ inspector: false,
+ debug: false,
+ uv: false,
+ ipv6: false,
+ tls_alpn: false,
+ tls_sni: false,
+ tls_ocsp: false,
+ tls: false,
+ cached_builtins: true,
+};
+var _fatalExceptions = noop;
+var setUncaughtExceptionCaptureCallback = noop;
+function hasUncaughtExceptionCaptureCallback() { return false; }var _tickCallback = noop;
+var _debugProcess = noop;
+var _debugEnd = noop;
+var _startProfilerIdleNotifier = noop;
+var _stopProfilerIdleNotifier = noop;
+var stdout = undefined;
+var stderr = undefined;
+var stdin = undefined;
+var abort = noop;
+var pid = 2;
+var ppid = 1;
+var execPath = '/bin/usr/node';
+var debugPort = 9229;
+var argv0 = 'node';
+var _preload_modules = [];
+var setSourceMapsEnabled = noop;
+
+var _performance = {
+ now: typeof performance !== 'undefined' ? performance.now.bind(performance) : undefined,
+ timing: typeof performance !== 'undefined' ? performance.timing : undefined,
+};
+if (_performance.now === undefined) {
+ var nowOffset = Date.now();
+
+ if (_performance.timing && _performance.timing.navigationStart) {
+ nowOffset = _performance.timing.navigationStart;
+ }
+ _performance.now = () => Date.now() - nowOffset;
+}
+
+function uptime() {
+ return _performance.now() / 1000;
+}
+
+var nanoPerSec = 1000000000;
+function hrtime(previousTimestamp) {
+ var baseNow = Math.floor((Date.now() - _performance.now()) * 1e-3);
+ var clocktime = _performance.now() * 1e-3;
+ var seconds = Math.floor(clocktime) + baseNow;
+ var nanoseconds = Math.floor((clocktime % 1) * 1e9);
+ if (previousTimestamp) {
+ seconds = seconds - previousTimestamp[0];
+ nanoseconds = nanoseconds - previousTimestamp[1];
+ if (nanoseconds < 0) {
+ seconds--;
+ nanoseconds += nanoPerSec;
+ }
+ }
+ return [seconds, nanoseconds];
+}hrtime.bigint = function(time) {
+ var diff = hrtime(time);
+ if (typeof BigInt === 'undefined') {
+ return diff[0] * nanoPerSec + diff[1];
+ }
+ return BigInt(diff[0] * nanoPerSec) + BigInt(diff[1]);
+};
+
+var _maxListeners = 10;
+var _events = {};
+var _eventsCount = 0;
+function on () { return process }var addListener = on;
+var once = on;
+var off = on;
+var removeListener = on;
+var removeAllListeners = on;
+var emit = noop;
+var prependListener = on;
+var prependOnceListener = on;
+function listeners (name) { return []; }
+var process = {
+ version,
+ versions,
+ arch,
+ platform,
+ release,
+ _rawDebug,
+ moduleLoadList,
+ binding,
+ _linkedBinding,
+ _events,
+ _eventsCount,
+ _maxListeners,
+ on,
+ addListener,
+ once,
+ off,
+ removeListener,
+ removeAllListeners,
+ emit,
+ prependListener,
+ prependOnceListener,
+ listeners,
+ domain,
+ _exiting,
+ config,
+ dlopen,
+ uptime,
+ _getActiveRequests,
+ _getActiveHandles,
+ reallyExit,
+ _kill,
+ cpuUsage,
+ resourceUsage,
+ memoryUsage,
+ kill,
+ exit,
+ openStdin,
+ allowedNodeEnvironmentFlags,
+ assert,
+ features,
+ _fatalExceptions,
+ setUncaughtExceptionCaptureCallback,
+ hasUncaughtExceptionCaptureCallback,
+ emitWarning,
+ nextTick,
+ _tickCallback,
+ _debugProcess,
+ _debugEnd,
+ _startProfilerIdleNotifier,
+ _stopProfilerIdleNotifier,
+ stdout,
+ stdin,
+ stderr,
+ abort,
+ umask,
+ chdir,
+ cwd,
+ env,
+ title,
+ argv,
+ execArgv,
+ pid,
+ ppid,
+ execPath,
+ debugPort,
+ hrtime,
+ argv0,
+ _preload_modules,
+ setSourceMapsEnabled,
+};
+
+export { _debugEnd, _debugProcess, _events, _eventsCount, _exiting, _fatalExceptions, _getActiveHandles, _getActiveRequests, _kill, _linkedBinding, _maxListeners, _preload_modules, _rawDebug, _startProfilerIdleNotifier, _stopProfilerIdleNotifier, _tickCallback, abort, addListener, allowedNodeEnvironmentFlags, arch, argv, argv0, assert, binding, chdir, config, cpuUsage, cwd, debugPort, process as default, dlopen, domain, emit, emitWarning, env, execArgv, execPath, exit, features, hasUncaughtExceptionCaptureCallback, hrtime, kill, listeners, memoryUsage, moduleLoadList, nextTick, off, on, once, openStdin, pid, platform, ppid, prependListener, prependOnceListener, reallyExit, release, removeAllListeners, removeListener, resourceUsage, setSourceMapsEnabled, setUncaughtExceptionCaptureCallback, stderr, stdin, stdout, title, umask, uptime, version, versions };
+
+//# sourceMappingURL=process.map
\ No newline at end of file
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_1620e8f9e144fe702a06.11_nodelibs_os b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_1620e8f9e144fe702a06.11_nodelibs_os
new file mode 100644
index 00000000000..65ca57a8711
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2.0.0-beta_1620e8f9e144fe702a06.11_nodelibs_os
@@ -0,0 +1,113 @@
+import { uptime } from './process';
+export { uptime } from './process';
+
+var exports = {},
+ _dewExec = false;
+function dew() {
+ if (_dewExec) return exports;
+ _dewExec = true;
+
+ exports.endianness = function () {
+ return "LE";
+ };
+
+ exports.hostname = function () {
+ if (typeof location !== "undefined") {
+ return location.hostname;
+ } else return "";
+ };
+
+ exports.loadavg = function () {
+ return [];
+ };
+
+ exports.uptime = function () {
+ return 0;
+ };
+
+ exports.freemem = function () {
+ return Number.MAX_VALUE;
+ };
+
+ exports.totalmem = function () {
+ return Number.MAX_VALUE;
+ };
+
+ exports.cpus = function () {
+ return [];
+ };
+
+ exports.type = function () {
+ return "Browser";
+ };
+
+ exports.release = function () {
+ if (typeof navigator !== "undefined") {
+ return navigator.appVersion;
+ }
+
+ return "";
+ };
+
+ exports.networkInterfaces = exports.getNetworkInterfaces = function () {
+ return {};
+ };
+
+ exports.arch = function () {
+ return "javascript";
+ };
+
+ exports.platform = function () {
+ return "browser";
+ };
+
+ exports.tmpdir = exports.tmpDir = function () {
+ return "/tmp";
+ };
+
+ exports.EOL = "\n";
+
+ exports.homedir = function () {
+ return "/";
+ };
+
+ return exports;
+}
+
+var os = dew();
+
+var _endianness = new Uint8Array(new Uint16Array([1]).buffer)[0] === 1 ? 'LE' : 'BE';
+os.endianness = function() { return _endianness; };
+os.homedir = function() { return '/home'; };
+os.version = function() { return ''; };
+os.arch = function() { return 'x64'; };
+os.totalmem = function() {
+ return navigator.deviceMemory !== undefined ? navigator.deviceMemory * (1 << 30) : 2 * (1 << 30);
+};
+os.cpus = function () {
+ return Array(navigator.hardwareConcurrency || 0).fill({ model: '', times: {} });
+};
+os.uptime = uptime;
+os.constants = {};
+var version = os.version;
+var constants = os.constants;
+var EOL = os.EOL;
+var arch = os.arch;
+var cpus = os.cpus;
+var endianness = os.endianness;
+var freemem = os.freemem;
+var getNetworkInterfaces = os.getNetworkInterfaces;
+var homedir = os.homedir;
+var hostname = os.hostname;
+var loadavg = os.loadavg;
+var networkInterfaces = os.networkInterfaces;
+var platform = os.platform;
+var release = os.release;
+var tmpDir = os.tmpDir;
+var tmpdir = os.tmpdir;
+var totalmem = os.totalmem;
+var type = os.type;
+
+export { EOL, arch, constants, cpus, os as default, endianness, freemem, getNetworkInterfaces, homedir, hostname, loadavg, networkInterfaces, platform, release, tmpDir, tmpdir, totalmem, type, version };
+
+//# sourceMappingURL=os.map
\ No newline at end of file
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_3fe9447e10c5fed754bb b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_3fe9447e10c5fed754bb
new file mode 100644
index 00000000000..4accb6487ef
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_jspm_core_2_nodelibs_os_3fe9447e10c5fed754bb
@@ -0,0 +1,3 @@
+import "/npm:@jspm/core@2.0.0-beta.11/nodelibs/process";
+export * from "/npm:@jspm/core@2.0.0-beta.11/nodelibs/os";
+export { default } from "/npm:@jspm/core@2.0.0-beta.11/nodelibs/os";
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/npm_p-map_5.1_9895e1a83d37d06ab277.0 b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_p-map_5.1_9895e1a83d37d06ab277.0
new file mode 100644
index 00000000000..5166d74476e
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/npm_p-map_5.1_9895e1a83d37d06ab277.0
@@ -0,0 +1,103 @@
+import AggregateError from './npm:aggregate-error@4';
+
+async function pMap(
+ iterable,
+ mapper,
+ {
+ concurrency = Number.POSITIVE_INFINITY,
+ stopOnError = true
+ } = {}
+) {
+ return new Promise((resolve, reject) => {
+ if (typeof mapper !== 'function') {
+ throw new TypeError('Mapper function is required');
+ }
+
+ if (!((Number.isSafeInteger(concurrency) || concurrency === Number.POSITIVE_INFINITY) && concurrency >= 1)) {
+ throw new TypeError(`Expected \`concurrency\` to be an integer from 1 and up or \`Infinity\`, got \`${concurrency}\` (${typeof concurrency})`);
+ }
+
+ const result = [];
+ const errors = [];
+ const skippedIndexes = [];
+ const iterator = iterable[Symbol.iterator]();
+ let isRejected = false;
+ let isIterableDone = false;
+ let resolvingCount = 0;
+ let currentIndex = 0;
+
+ const next = () => {
+ if (isRejected) {
+ return;
+ }
+
+ const nextItem = iterator.next();
+ const index = currentIndex;
+ currentIndex++;
+
+ if (nextItem.done) {
+ isIterableDone = true;
+
+ if (resolvingCount === 0) {
+ if (!stopOnError && errors.length > 0) {
+ reject(new AggregateError(errors));
+ } else {
+ for (const skippedIndex of skippedIndexes) {
+ result.splice(skippedIndex, 1);
+ }
+
+ resolve(result);
+ }
+ }
+
+ return;
+ }
+
+ resolvingCount++;
+
+ (async () => {
+ try {
+ const element = await nextItem.value;
+
+ if (isRejected) {
+ return;
+ }
+
+ const value = await mapper(element, index);
+ if (value === pMapSkip) {
+ skippedIndexes.push(index);
+ } else {
+ result[index] = value;
+ }
+
+ resolvingCount--;
+ next();
+ } catch (error) {
+ if (stopOnError) {
+ isRejected = true;
+ reject(error);
+ } else {
+ errors.push(error);
+ resolvingCount--;
+ next();
+ }
+ }
+ })();
+ };
+
+ for (let index = 0; index < concurrency; index++) {
+ next();
+
+ if (isIterableDone) {
+ break;
+ }
+ }
+ });
+}
+
+const pMapSkip = Symbol('skip');
+
+export default pMap;
+export { pMapSkip };
+
+//# sourceMappingURL=npm:p-map@5.1.0.map
\ No newline at end of file
diff --git a/examples/build-http/webpack.lock.data/https_jspm.dev/p-map_875efed0b6bd20646dd2 b/examples/build-http/webpack.lock.data/https_jspm.dev/p-map_875efed0b6bd20646dd2
new file mode 100644
index 00000000000..95b490c4578
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_jspm.dev/p-map_875efed0b6bd20646dd2
@@ -0,0 +1,3 @@
+import "/npm:aggregate-error@4";
+export * from "/npm:p-map@5.1.0";
+export { default } from "/npm:p-map@5.1.0";
diff --git a/examples/build-http/webpack.lock.data/https_unpkg.com/p-map-series_3.0.0_index_module_cb329557880410b778cf.js b/examples/build-http/webpack.lock.data/https_unpkg.com/p-map-series_3.0.0_index_module_cb329557880410b778cf.js
new file mode 100644
index 00000000000..f9ee01a45ae
--- /dev/null
+++ b/examples/build-http/webpack.lock.data/https_unpkg.com/p-map-series_3.0.0_index_module_cb329557880410b778cf.js
@@ -0,0 +1,11 @@
+export default async function pMapSeries(iterable, mapper) {
+ const result = [];
+ let index = 0;
+
+ for (const value of iterable) {
+ // eslint-disable-next-line no-await-in-loop
+ result.push((await mapper((await value), index++)));
+ }
+
+ return result;
+}
\ No newline at end of file
diff --git a/examples/chunkhash/README.md b/examples/chunkhash/README.md
index a18d19a83df..fee9f799de2 100644
--- a/examples/chunkhash/README.md
+++ b/examples/chunkhash/README.md
@@ -20,7 +20,7 @@ import("./async2");
```javascript
var path = require("path");
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
main: "./example"
},
@@ -43,7 +43,7 @@ module.exports = {
@@ -69,8 +69,9 @@ module.exports = {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -89,13 +90,42 @@ module.exports = {
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/create fake namespace object */
/******/ (() => {
-/******/ var getProto = Object.getPrototypeOf ? (obj) => Object.getPrototypeOf(obj) : (obj) => obj.__proto__;
+/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ var leafPrototypes;
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
@@ -115,9 +145,9 @@ module.exports = {
/******/ var def = {};
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
-/******/ Object.getOwnPropertyNames(current).forEach(key => def[key] = () => value[key]);
+/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ }
-/******/ def['default'] = () => value;
+/******/ def['default'] = () => (value);
/******/ __webpack_require__.d(ns, def);
/******/ return ns;
/******/ };
@@ -159,7 +189,7 @@ module.exports = {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -167,7 +197,7 @@ module.exports = {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -197,10 +227,9 @@ module.exports = {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -230,14 +259,11 @@ module.exports = {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 1: 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/
-/******/ ];
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -247,11 +273,9 @@ module.exports = {
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
-/******/ if(true) { // all chunks have JS
+/******/ if(1 != chunkId) {
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -273,7 +297,7 @@ module.exports = {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -287,69 +311,36 @@ module.exports = {
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -358,8 +349,8 @@ module.exports = {
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/
/******/ })()
;
```
@@ -383,7 +374,11 @@ __webpack_require__.e(/*! import() */ 3).then(__webpack_require__.t.bind(__webpa
/***/ })
],
-0,[[0,1]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
```
# Info
@@ -391,19 +386,19 @@ __webpack_require__.e(/*! import() */ 3).then(__webpack_require__.t.bind(__webpa
## Unoptimized
```
-asset runtime~main.[chunkhash].js 12.5 KiB [emitted] (name: runtime~main)
-asset main.[chunkhash].js 652 bytes [emitted] (name: main)
+asset runtime~main.[chunkhash].js 12.2 KiB [emitted] (name: runtime~main)
+asset main.[chunkhash].js 873 bytes [emitted] (name: main)
asset 2.[chunkhash].js 285 bytes [emitted]
asset 3.[chunkhash].js 279 bytes [emitted]
-Entrypoint main 13.1 KiB = runtime~main.[chunkhash].js 12.5 KiB main.[chunkhash].js 652 bytes
+Entrypoint main 13 KiB = runtime~main.[chunkhash].js 12.2 KiB main.[chunkhash].js 873 bytes
chunk (runtime: runtime~main) main.[chunkhash].js (main) 55 bytes [initial] [rendered]
> ./example main
./example.js 55 bytes [built] [code generated]
[used exports unknown]
entry ./example main
-chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.7 KiB [entry] [rendered]
+chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.59 KiB [entry] [rendered]
> ./example main
- runtime modules 7.7 KiB 9 modules
+ runtime modules 7.59 KiB 10 modules
chunk (runtime: runtime~main) 2.[chunkhash].js 28 bytes [rendered]
> ./async1 ./example.js 2:0-18
./async1.js 28 bytes [built] [code generated]
@@ -414,17 +409,17 @@ chunk (runtime: runtime~main) 3.[chunkhash].js 28 bytes [rendered]
./async2.js 28 bytes [built] [code generated]
[used exports unknown]
import() ./async2 ./example.js 3:0-18
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset runtime~main.[chunkhash].js 2.63 KiB [emitted] [minimized] (name: runtime~main)
-asset main.[chunkhash].js 155 bytes [emitted] [minimized] (name: main)
+asset runtime~main.[chunkhash].js 2.73 KiB [emitted] [minimized] (name: runtime~main)
+asset main.[chunkhash].js 157 bytes [emitted] [minimized] (name: main)
asset 114.[chunkhash].js 69 bytes [emitted] [minimized]
asset 172.[chunkhash].js 69 bytes [emitted] [minimized]
-Entrypoint main 2.78 KiB = runtime~main.[chunkhash].js 2.63 KiB main.[chunkhash].js 155 bytes
+Entrypoint main 2.88 KiB = runtime~main.[chunkhash].js 2.73 KiB main.[chunkhash].js 157 bytes
chunk (runtime: runtime~main) 114.[chunkhash].js 28 bytes [rendered]
> ./async1 ./example.js 2:0-18
./async1.js 28 bytes [built] [code generated]
@@ -440,8 +435,8 @@ chunk (runtime: runtime~main) main.[chunkhash].js (main) 55 bytes [initial] [ren
./example.js 55 bytes [built] [code generated]
[no exports used]
entry ./example main
-chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.7 KiB [entry] [rendered]
+chunk (runtime: runtime~main) runtime~main.[chunkhash].js (runtime~main) 7.59 KiB [entry] [rendered]
> ./example main
- runtime modules 7.7 KiB 9 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 7.59 KiB 10 modules
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/chunkhash/webpack.config.js b/examples/chunkhash/webpack.config.js
index cc34d5591f9..727e187cf1b 100644
--- a/examples/chunkhash/webpack.config.js
+++ b/examples/chunkhash/webpack.config.js
@@ -1,6 +1,7 @@
-var path = require("path");
+const path = require("path");
+
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
main: "./example"
},
diff --git a/examples/cjs-tree-shaking/README.md b/examples/cjs-tree-shaking/README.md
index 99aac42c798..de5a11748f0 100644
--- a/examples/cjs-tree-shaking/README.md
+++ b/examples/cjs-tree-shaking/README.md
@@ -65,7 +65,7 @@ exports.multiply = function multiply() {
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
var __webpack_unused_export__;
-const add = __webpack_require__(/*! ./math */ 2)/* .add */ .I;
+const add = (__webpack_require__(/*! ./math */ 2)/* .add */ .I);
exports.nP = function increment(val) {
return add(val, 1);
};
@@ -126,8 +126,9 @@ __webpack_unused_export__ = function multiply() {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -149,13 +150,15 @@ __webpack_unused_export__ = function multiply() {
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
\********************/
/*! unknown exports (runtime-defined) */
/*! runtime requirements: __webpack_require__ */
-const inc = __webpack_require__(/*! ./increment */ 1)/* .increment */ .nP;
+const inc = (__webpack_require__(/*! ./increment */ 1)/* .increment */ .nP);
var a = 1;
inc(a); // 2
@@ -169,14 +172,14 @@ inc(a); // 2
```javascript
/*! For license information please see output.js.LICENSE.txt */
-(()=>{var r=[,(r,n,t)=>{const e=t(2).I;n.nP=function(r){return e(r,1)}},(r,n)=>{n.I=function(){for(var r=0,n=0,t=arguments,e=t.length;n{var r=[,(r,n,t)=>{const o=t(2).I;n.nP=function(r){return o(r,1)}},(r,n)=>{n.I=function(){for(var r=0,n=0,t=arguments,o=t.length;n{var n=[,(n,r,t)=>{const e=t(2).add;r.increment=function(n){return e(n,1)},r.incrementBy2=function(n){return e(n,2)},r.decrement=function(n){return e(n,1)}},(n,r)=>{r.add=function(){for(var n=0,r=0,t=arguments,e=t.length;r{var n=[,(n,r,t)=>{const e=t(2).add;r.increment=function(n){return e(n,1)},r.incrementBy2=function(n){return e(n,2)},r.decrement=function(n){return e(n,1)}},(n,r)=>{r.add=function(){for(var n=0,r=0,t=arguments,e=t.length;r ./example.js main
dependent modules 564 bytes [dependent] 2 modules
./example.js 70 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
-asset without.js 2.91 KiB [emitted] (name: main)
+asset without.js 3.08 KiB [emitted] (name: main)
chunk (runtime: main) without.js (main) 634 bytes [entry] [rendered]
> ./example.js main
dependent modules 564 bytes [dependent] 2 modules
./example.js 70 bytes [built] [code generated]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 351 bytes [emitted] [minimized] (name: main) 1 related asset
+asset output.js 365 bytes [emitted] [minimized] (name: main) 1 related asset
chunk (runtime: main) output.js (main) 634 bytes [entry] [rendered]
> ./example.js main
dependent modules 564 bytes [dependent] 2 modules
./example.js 70 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
-asset without.js 537 bytes [emitted] [minimized] (name: main) 1 related asset
+asset without.js 551 bytes [emitted] [minimized] (name: main) 1 related asset
chunk (runtime: main) without.js (main) 634 bytes [entry] [rendered]
> ./example.js main
dependent modules 564 bytes [dependent] 2 modules
./example.js 70 bytes [built] [code generated]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitted-require.context-amd/README.md b/examples/code-splitted-require.context-amd/README.md
index 0645f2375a2..abe1922c425 100644
--- a/examples/code-splitted-require.context-amd/README.md
+++ b/examples/code-splitted-require.context-amd/README.md
@@ -31,8 +31,9 @@ getTemplate("b", function(b) {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -76,7 +77,7 @@ getTemplate("b", function(b) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -84,7 +85,7 @@ getTemplate("b", function(b) {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -114,10 +115,9 @@ getTemplate("b", function(b) {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -136,12 +136,11 @@ getTemplate("b", function(b) {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -153,9 +152,7 @@ getTemplate("b", function(b) {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -177,7 +174,7 @@ getTemplate("b", function(b) {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -191,39 +188,36 @@ getTemplate("b", function(b) {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -232,6 +226,7 @@ getTemplate("b", function(b) {
``` js
+var __webpack_exports__ = {};
/*!********************!*\
!*** ./example.js ***!
\********************/
@@ -240,7 +235,7 @@ getTemplate("b", function(b) {
function getTemplate(templateName, callback) {
__webpack_require__.e(/*! AMD require */ 577).then(function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(1)("./"+templateName)]; (function(tmpl) {
callback(tmpl());
- }).apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);}).catch(__webpack_require__.oe);
+ }).apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);})['catch'](__webpack_require__.oe);
}
getTemplate("a", function(a) {
console.log(a);
@@ -361,7 +356,7 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered]
[no exports]
[used exports unknown]
amd require context ./example.js 2:1-4:3
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -381,5 +376,5 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered]
../require.context/templates/ sync ^\.\/.*$ 217 bytes [built] [code generated]
[no exports]
amd require context ./example.js 2:1-4:3
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitted-require.context/README.md b/examples/code-splitted-require.context/README.md
index 1073a2b087d..89fe83e2106 100644
--- a/examples/code-splitted-require.context/README.md
+++ b/examples/code-splitted-require.context/README.md
@@ -31,8 +31,9 @@ getTemplate("b", function(b) {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -76,7 +77,7 @@ getTemplate("b", function(b) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -84,7 +85,7 @@ getTemplate("b", function(b) {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -114,10 +115,9 @@ getTemplate("b", function(b) {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -136,12 +136,11 @@ getTemplate("b", function(b) {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -153,9 +152,7 @@ getTemplate("b", function(b) {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -177,7 +174,7 @@ getTemplate("b", function(b) {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -191,39 +188,36 @@ getTemplate("b", function(b) {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -232,6 +226,7 @@ getTemplate("b", function(b) {
``` js
+var __webpack_exports__ = {};
/*!********************!*\
!*** ./example.js ***!
\********************/
@@ -240,7 +235,7 @@ getTemplate("b", function(b) {
function getTemplate(templateName, callback) {
__webpack_require__.e(/*! require.ensure */ 577).then((function(require) {
callback(__webpack_require__(1)("./"+templateName)());
- }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+ }).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
}
getTemplate("a", function(a) {
console.log(a);
@@ -346,7 +341,7 @@ module.exports = function() {
## Unoptimized
```
-asset output.js 8.96 KiB [emitted] (name: main)
+asset output.js 8.95 KiB [emitted] (name: main)
asset 577.output.js 2.23 KiB [emitted]
chunk (runtime: main) output.js (main) 266 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered]
> ./example.js main
@@ -361,7 +356,7 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered]
[no exports]
[used exports unknown]
cjs require context ./example.js 3:11-64
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -381,5 +376,5 @@ chunk (runtime: main) 577.output.js 457 bytes [rendered]
../require.context/templates/ sync ^\.\/.*$ 217 bytes [built] [code generated]
[no exports]
cjs require context ./example.js 3:11-64
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting-bundle-loader/README.md b/examples/code-splitting-bundle-loader/README.md
index 25c3fe5aed7..4ab296f9c6e 100644
--- a/examples/code-splitting-bundle-loader/README.md
+++ b/examples/code-splitting-bundle-loader/README.md
@@ -44,7 +44,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
for(var i = 0, l = callbacks.length; i < l; i++) {
callbacks[i](data);
}
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
/***/ })
/******/ ]);
@@ -60,8 +60,9 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -105,7 +106,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -113,7 +114,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -143,10 +144,9 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -165,12 +165,11 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -182,9 +181,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -206,7 +203,7 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -220,39 +217,36 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -261,6 +255,8 @@ __webpack_require__.e(/*! require.ensure */ 929).then((function(require) {
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -303,7 +299,7 @@ module.exports = "It works";
## Unoptimized
```
-asset output.js 9.58 KiB [emitted] (name: main)
+asset output.js 9.68 KiB [emitted] (name: main)
asset 929.output.js 354 bytes [emitted]
chunk (runtime: main) output.js (main) 375 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered]
> ./example.js main
@@ -318,13 +314,13 @@ chunk (runtime: main) 929.output.js 28 bytes [rendered]
[used exports unknown]
cjs self exports reference ./file.js 1:0-14
cjs require !!./file.js ../../node_modules/bundle-loader/index.js!./file.js 8:8-30
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 1.84 KiB [emitted] [minimized] (name: main)
+asset output.js 1.85 KiB [emitted] [minimized] (name: main)
asset 929.output.js 88 bytes [emitted] [minimized]
chunk (runtime: main) output.js (main) 375 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered]
> ./example.js main
@@ -339,5 +335,5 @@ chunk (runtime: main) 929.output.js 28 bytes [rendered]
[used exports unknown]
cjs self exports reference ./file.js 1:0-14
cjs require !!./file.js ../../node_modules/bundle-loader/index.js!./file.js 8:8-30
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting-depend-on-advanced/README.md b/examples/code-splitting-depend-on-advanced/README.md
index 66766b04e01..09b2c0df6cb 100644
--- a/examples/code-splitting-depend-on-advanced/README.md
+++ b/examples/code-splitting-depend-on-advanced/README.md
@@ -79,8 +79,9 @@ console.log(lodash, isomorphicFetch);
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -99,17 +100,46 @@ console.log(lodash, isomorphicFetch);
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
-/******/ () => module['default'] :
-/******/ () => module;
+/******/ () => (module['default']) :
+/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
@@ -151,7 +181,7 @@ console.log(lodash, isomorphicFetch);
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -159,7 +189,7 @@ console.log(lodash, isomorphicFetch);
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -189,10 +219,9 @@ console.log(lodash, isomorphicFetch);
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -222,14 +251,11 @@ console.log(lodash, isomorphicFetch);
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "runtime": 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/
-/******/ ];
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -239,11 +265,9 @@ console.log(lodash, isomorphicFetch);
/******/ if(installedChunkData) {
/******/ promises.push(installedChunkData[2]);
/******/ } else {
-/******/ if(true) { // all chunks have JS
+/******/ if("runtime" != chunkId) {
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -265,7 +289,7 @@ console.log(lodash, isomorphicFetch);
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -279,69 +303,36 @@ console.log(lodash, isomorphicFetch);
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -350,8 +341,8 @@ console.log(lodash, isomorphicFetch);
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/
/******/ })()
;
```
@@ -359,9 +350,10 @@ console.log(lodash, isomorphicFetch);
# dist/app.js
```javascript
+"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([["app"],{
-/***/ 7:
+/***/ 6:
/*!****************!*\
!*** ./app.js ***!
\****************/
@@ -370,7 +362,6 @@ console.log(lodash, isomorphicFetch);
/*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! isomorphic-fetch */ 5);
/* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__);
@@ -385,15 +376,21 @@ console.log((isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default()), (lodash__
/***/ })
},
-0,[[7,"runtime","other-vendors"]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ __webpack_require__.O(0, ["other-vendors"], () => (__webpack_exec__(6)));
+/******/ var __webpack_exports__ = __webpack_require__.O();
+/******/ }
+]);
```
# dist/page1.js
```javascript
+"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([["page1"],{
-/***/ 6:
+/***/ 7:
/*!******************!*\
!*** ./page1.js ***!
\******************/
@@ -402,7 +399,6 @@ console.log((isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default()), (lodash__
/*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! isomorphic-fetch */ 5);
/* harmony import */ var isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(isomorphic_fetch__WEBPACK_IMPORTED_MODULE_0__);
@@ -422,7 +418,12 @@ __webpack_require__.e(/*! import() */ "lazy_js").then(__webpack_require__.bind(_
/***/ })
},
-0,[[6,"app","runtime","react-vendors","other-vendors"]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ __webpack_require__.O(0, ["app","react-vendors","other-vendors"], () => (__webpack_exec__(7)));
+/******/ var __webpack_exports__ = __webpack_require__.O();
+/******/ }
+]);
```
# dist/other-vendors.js
@@ -482,7 +483,11 @@ module.exports = "isomorphic-fetch";
/***/ })
],
-0,[[3,"runtime"]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(3));
+/******/ }
+]);
```
# dist/react-vendors.js
@@ -529,7 +534,11 @@ module.exports = 'prop-types';
/***/ })
],
-0,[[0,"runtime"],[1,"runtime"],[2,"runtime"]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0), __webpack_exec__(1), __webpack_exec__(2));
+/******/ }
+]);
```
# Info
@@ -537,16 +546,16 @@ module.exports = 'prop-types';
## Unoptimized
```
-asset runtime.js 11.4 KiB [emitted] (name: runtime)
-asset other-vendors.js 1.92 KiB [emitted] (name: other-vendors)
-asset page1.js 1.64 KiB [emitted] (name: page1)
-asset app.js 1.17 KiB [emitted] (name: app)
+asset runtime.js 11.1 KiB [emitted] (name: runtime)
+asset other-vendors.js 2.13 KiB [emitted] (name: other-vendors)
+asset page1.js 1.91 KiB [emitted] (name: page1)
+asset app.js 1.44 KiB [emitted] (name: app)
+asset react-vendors.js 1.33 KiB [emitted] (name: react-vendors)
asset lazy_js.js 1.11 KiB [emitted]
-asset react-vendors.js 1.1 KiB [emitted] (name: react-vendors)
-Entrypoint app 1.17 KiB = app.js
-Entrypoint page1 1.64 KiB = page1.js
-Entrypoint react-vendors 12.5 KiB = runtime.js 11.4 KiB react-vendors.js 1.1 KiB
-Entrypoint other-vendors 13.3 KiB = runtime.js 11.4 KiB other-vendors.js 1.92 KiB
+Entrypoint app 1.44 KiB = app.js
+Entrypoint page1 1.91 KiB = page1.js
+Entrypoint react-vendors 12.4 KiB = runtime.js 11.1 KiB react-vendors.js 1.33 KiB
+Entrypoint other-vendors 13.3 KiB = runtime.js 11.1 KiB other-vendors.js 2.13 KiB
chunk (runtime: runtime) app.js (app) 116 bytes <{other-vendors}> <{runtime}> >{page1}< [initial] [rendered]
> ./app.js app
./app.js 116 bytes [built] [code generated]
@@ -578,44 +587,47 @@ chunk (runtime: runtime) react-vendors.js (react-vendors) 87 bytes ={runtime}= >
> react-dom react-vendors
./node_modules/prop-types.js 31 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation prop-types ./lazy.js 2:0-35
- harmony import specifier prop-types ./lazy.js 4:20-29
+ from origin ./lazy.js
+ harmony side effect evaluation prop-types ./lazy.js 2:0-35
+ harmony import specifier prop-types ./lazy.js 4:20-29
cjs self exports reference ./node_modules/prop-types.js 1:0-14
entry prop-types react-vendors
./node_modules/react-dom.js 30 bytes [built] [code generated]
[used exports unknown]
+ from origin ./page1.js
+ harmony side effect evaluation react-dom ./page1.js 3:0-33
+ harmony import specifier react-dom ./page1.js 5:36-44
cjs self exports reference ./node_modules/react-dom.js 1:0-14
- harmony side effect evaluation react-dom ./page1.js 3:0-33
- harmony import specifier react-dom ./page1.js 5:36-44
entry react-dom react-vendors
./node_modules/react.js 26 bytes [built] [code generated]
[used exports unknown]
+ from origin ./page1.js
+ harmony side effect evaluation react ./page1.js 2:0-26
+ harmony import specifier react ./page1.js 5:29-34
cjs self exports reference ./node_modules/react.js 1:0-14
- harmony side effect evaluation react ./page1.js 2:0-26
- harmony import specifier react ./page1.js 5:29-34
entry react react-vendors
-chunk (runtime: runtime) runtime.js (runtime) 6.85 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered]
+chunk (runtime: runtime) runtime.js (runtime) 6.74 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered]
> ./other-vendors other-vendors
> prop-types react-vendors
> react react-vendors
> react-dom react-vendors
- runtime modules 6.85 KiB 9 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 6.74 KiB 10 modules
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset runtime.js 2.26 KiB [emitted] [minimized] (name: runtime)
-asset page1.js 264 bytes [emitted] [minimized] (name: page1)
-asset other-vendors.js 243 bytes [emitted] [minimized] (name: other-vendors)
-asset react-vendors.js 208 bytes [emitted] [minimized] (name: react-vendors)
-asset app.js 184 bytes [emitted] [minimized] (name: app)
+asset runtime.js 2.37 KiB [emitted] [minimized] (name: runtime)
+asset page1.js 287 bytes [emitted] [minimized] (name: page1)
+asset other-vendors.js 239 bytes [emitted] [minimized] (name: other-vendors)
+asset app.js 207 bytes [emitted] [minimized] (name: app)
+asset react-vendors.js 200 bytes [emitted] [minimized] (name: react-vendors)
asset lazy_js.js 159 bytes [emitted] [minimized]
-Entrypoint app 184 bytes = app.js
-Entrypoint page1 264 bytes = page1.js
-Entrypoint react-vendors 2.46 KiB = runtime.js 2.26 KiB react-vendors.js 208 bytes
-Entrypoint other-vendors 2.5 KiB = runtime.js 2.26 KiB other-vendors.js 243 bytes
+Entrypoint app 207 bytes = app.js
+Entrypoint page1 287 bytes = page1.js
+Entrypoint react-vendors 2.56 KiB = runtime.js 2.37 KiB react-vendors.js 200 bytes
+Entrypoint other-vendors 2.6 KiB = runtime.js 2.37 KiB other-vendors.js 239 bytes
chunk (runtime: runtime) app.js (app) 116 bytes <{other-vendors}> <{runtime}> >{page1}< [initial] [rendered]
> ./app.js app
./app.js 116 bytes [built] [code generated]
@@ -646,27 +658,30 @@ chunk (runtime: runtime) react-vendors.js (react-vendors) 87 bytes ={runtime}= >
> react-dom react-vendors
./node_modules/prop-types.js 31 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation prop-types ./lazy.js 2:0-35
- harmony import specifier prop-types ./lazy.js 4:20-29
+ from origin ./lazy.js
+ harmony side effect evaluation prop-types ./lazy.js 2:0-35
+ harmony import specifier prop-types ./lazy.js 4:20-29
cjs self exports reference ./node_modules/prop-types.js 1:0-14
entry prop-types react-vendors
./node_modules/react-dom.js 30 bytes [built] [code generated]
[used exports unknown]
+ from origin ./page1.js
+ harmony side effect evaluation react-dom ./page1.js 3:0-33
+ harmony import specifier react-dom ./page1.js 5:36-44
cjs self exports reference ./node_modules/react-dom.js 1:0-14
- harmony side effect evaluation react-dom ./page1.js 3:0-33
- harmony import specifier react-dom ./page1.js 5:36-44
entry react-dom react-vendors
./node_modules/react.js 26 bytes [built] [code generated]
[used exports unknown]
+ from origin ./page1.js
+ harmony side effect evaluation react ./page1.js 2:0-26
+ harmony import specifier react ./page1.js 5:29-34
cjs self exports reference ./node_modules/react.js 1:0-14
- harmony side effect evaluation react ./page1.js 2:0-26
- harmony import specifier react ./page1.js 5:29-34
entry react react-vendors
-chunk (runtime: runtime) runtime.js (runtime) 6.85 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered]
+chunk (runtime: runtime) runtime.js (runtime) 6.74 KiB ={other-vendors}= ={react-vendors}= >{app}< >{page1}< [entry] [rendered]
> ./other-vendors other-vendors
> prop-types react-vendors
> react react-vendors
> react-dom react-vendors
- runtime modules 6.85 KiB 9 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 6.74 KiB 10 modules
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting-depend-on-simple/README.md b/examples/code-splitting-depend-on-simple/README.md
index ce39033f28e..df67b1bbcc0 100644
--- a/examples/code-splitting-depend-on-simple/README.md
+++ b/examples/code-splitting-depend-on-simple/README.md
@@ -31,6 +31,7 @@ console.log(react, reactDOM, propTypes);
# dist/app.js
```javascript
+"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([["app"],{
/***/ 3:
@@ -42,7 +43,6 @@ console.log(react, reactDOM, propTypes);
/*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! react */ 0);
/* harmony import */ var react__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(react__WEBPACK_IMPORTED_MODULE_0__);
@@ -60,7 +60,11 @@ console.log((react__WEBPACK_IMPORTED_MODULE_0___default()), (react_dom__WEBPACK_
/***/ })
},
-0,[[3,"react-vendors"]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(3));
+/******/ }
+]);
```
# dist/react-vendors.js
@@ -120,8 +124,9 @@ module.exports = 'prop-types';
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -140,17 +145,46 @@ module.exports = 'prop-types';
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
-/******/ () => module['default'] :
-/******/ () => module;
+/******/ () => (module['default']) :
+/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
@@ -170,7 +204,7 @@ module.exports = 'prop-types';
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
@@ -190,16 +224,11 @@ module.exports = 'prop-types';
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "react-vendors": 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/ [0],
-/******/ [1],
-/******/ [2]
-/******/ ];
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
@@ -210,69 +239,36 @@ module.exports = 'prop-types';
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -281,8 +277,15 @@ module.exports = 'prop-types';
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module is referenced by other modules so it can't be inlined
+/******/ __webpack_require__(0);
+/******/ __webpack_require__(1);
+/******/ var __webpack_exports__ = __webpack_require__(2);
+/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
+/******/
/******/ })()
;
```
@@ -292,75 +295,81 @@ module.exports = 'prop-types';
## Unoptimized
```
-asset react-vendors.js 7.56 KiB [emitted] (name: react-vendors)
-asset app.js 1.43 KiB [emitted] (name: app)
+asset react-vendors.js 7.62 KiB [emitted] (name: react-vendors)
+asset app.js 1.63 KiB [emitted] (name: app)
chunk (runtime: react-vendors) app.js (app) 139 bytes <{react-vendors}> [initial] [rendered]
> ./app.js app
./app.js 139 bytes [built] [code generated]
[no exports]
[used exports unknown]
entry ./app.js app
-chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.42 KiB (runtime) >{app}< [entry] [rendered]
+chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.29 KiB (runtime) >{app}< [entry] [rendered]
> prop-types react-vendors
> react react-vendors
> react-dom react-vendors
- runtime modules 3.42 KiB 5 modules
+ runtime modules 3.29 KiB 6 modules
cacheable modules 87 bytes
./node_modules/prop-types.js 31 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation prop-types ./app.js 3:0-35
- harmony import specifier prop-types ./app.js 5:29-38
+ from origin ./app.js
+ harmony side effect evaluation prop-types ./app.js 3:0-35
+ harmony import specifier prop-types ./app.js 5:29-38
cjs self exports reference ./node_modules/prop-types.js 1:0-14
entry prop-types react-vendors
./node_modules/react-dom.js 30 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation react-dom ./app.js 2:0-33
- harmony import specifier react-dom ./app.js 5:19-27
+ from origin ./app.js
+ harmony side effect evaluation react-dom ./app.js 2:0-33
+ harmony import specifier react-dom ./app.js 5:19-27
cjs self exports reference ./node_modules/react-dom.js 1:0-14
entry react-dom react-vendors
./node_modules/react.js 26 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation react ./app.js 1:0-26
- harmony import specifier react ./app.js 5:12-17
+ from origin ./app.js
+ harmony side effect evaluation react ./app.js 1:0-26
+ harmony import specifier react ./app.js 5:12-17
cjs self exports reference ./node_modules/react.js 1:0-14
entry react react-vendors
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset react-vendors.js 1.05 KiB [emitted] [minimized] (name: react-vendors)
-asset app.js 195 bytes [emitted] [minimized] (name: app)
+asset react-vendors.js 1.15 KiB [emitted] [minimized] (name: react-vendors)
+asset app.js 185 bytes [emitted] [minimized] (name: app)
chunk (runtime: react-vendors) app.js (app) 139 bytes <{react-vendors}> [initial] [rendered]
> ./app.js app
./app.js 139 bytes [built] [code generated]
[no exports]
[no exports used]
entry ./app.js app
-chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.15 KiB (runtime) >{app}< [entry] [rendered]
+chunk (runtime: react-vendors) react-vendors.js (react-vendors) 87 bytes (javascript) 3.03 KiB (runtime) >{app}< [entry] [rendered]
> prop-types react-vendors
> react react-vendors
> react-dom react-vendors
- runtime modules 3.15 KiB 4 modules
+ runtime modules 3.03 KiB 5 modules
cacheable modules 87 bytes
./node_modules/prop-types.js 31 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation prop-types ./app.js 3:0-35
- harmony import specifier prop-types ./app.js 5:29-38
+ from origin ./app.js
+ harmony side effect evaluation prop-types ./app.js 3:0-35
+ harmony import specifier prop-types ./app.js 5:29-38
cjs self exports reference ./node_modules/prop-types.js 1:0-14
entry prop-types react-vendors
./node_modules/react-dom.js 30 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation react-dom ./app.js 2:0-33
- harmony import specifier react-dom ./app.js 5:19-27
+ from origin ./app.js
+ harmony side effect evaluation react-dom ./app.js 2:0-33
+ harmony import specifier react-dom ./app.js 5:19-27
cjs self exports reference ./node_modules/react-dom.js 1:0-14
entry react-dom react-vendors
./node_modules/react.js 26 bytes [built] [code generated]
[used exports unknown]
- harmony side effect evaluation react ./app.js 1:0-26
- harmony import specifier react ./app.js 5:12-17
+ from origin ./app.js
+ harmony side effect evaluation react ./app.js 1:0-26
+ harmony import specifier react ./app.js 5:12-17
cjs self exports reference ./node_modules/react.js 1:0-14
entry react react-vendors
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting-harmony/README.md b/examples/code-splitting-harmony/README.md
index 7ffefdb5c4c..7372a379e99 100644
--- a/examples/code-splitting-harmony/README.md
+++ b/examples/code-splitting-harmony/README.md
@@ -29,35 +29,7 @@ Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
```javascript
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ([
-/* 0 */
-/*!********************!*\
- !*** ./example.js ***!
- \********************/
-/*! namespace exports */
-/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.t, __webpack_require__.* */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! a */ 1);
-/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(a__WEBPACK_IMPORTED_MODULE_0__);
-
-
-__webpack_require__.e(/*! import() */ 644).then(__webpack_require__.t.bind(__webpack_require__, /*! b */ 3, 23)).then(function(b) {
- console.log("b loaded", b);
-})
-
-function loadC(name) {
- return __webpack_require__(2)("./" + name);
-}
-
-Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
- console.log("c/1 and c/2 loaded", arr);
-});
-
-
-/***/ }),
+/* 0 */,
/* 1 */
/*!***************************!*\
!*** ./node_modules/a.js ***!
@@ -107,10 +79,10 @@ function webpackAsyncContext(req) {
var ids = map[req], id = ids[0];
return __webpack_require__.e(ids[1]).then(() => {
- return __webpack_require__.t(id, 7);
+ return __webpack_require__.t(id, 7 | 16);
});
}
-webpackAsyncContext.keys = () => Object.keys(map);
+webpackAsyncContext.keys = () => (Object.keys(map));
webpackAsyncContext.id = 2;
module.exports = webpackAsyncContext;
@@ -128,8 +100,9 @@ module.exports = webpackAsyncContext;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -154,8 +127,8 @@ module.exports = webpackAsyncContext;
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
-/******/ () => module['default'] :
-/******/ () => module;
+/******/ () => (module['default']) :
+/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
@@ -163,7 +136,7 @@ module.exports = webpackAsyncContext;
/******/
/******/ /* webpack/runtime/create fake namespace object */
/******/ (() => {
-/******/ var getProto = Object.getPrototypeOf ? (obj) => Object.getPrototypeOf(obj) : (obj) => obj.__proto__;
+/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ var leafPrototypes;
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
@@ -183,9 +156,9 @@ module.exports = webpackAsyncContext;
/******/ var def = {};
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
-/******/ Object.getOwnPropertyNames(current).forEach(key => def[key] = () => value[key]);
+/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ }
-/******/ def['default'] = () => value;
+/******/ def['default'] = () => (value);
/******/ __webpack_require__.d(ns, def);
/******/ return ns;
/******/ };
@@ -227,7 +200,7 @@ module.exports = webpackAsyncContext;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -235,7 +208,7 @@ module.exports = webpackAsyncContext;
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -265,10 +238,9 @@ module.exports = webpackAsyncContext;
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -298,12 +270,11 @@ module.exports = webpackAsyncContext;
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -315,9 +286,7 @@ module.exports = webpackAsyncContext;
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -339,7 +308,7 @@ module.exports = webpackAsyncContext;
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -353,39 +322,36 @@ module.exports = webpackAsyncContext;
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -394,10 +360,35 @@ module.exports = webpackAsyncContext;
``` js
-/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
-/******/ // This entry module used 'exports' so it can't be inlined
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be in strict mode.
+(() => {
+"use strict";
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.n, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.t, __webpack_require__.* */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! a */ 1);
+/* harmony import */ var a__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(a__WEBPACK_IMPORTED_MODULE_0__);
+
+
+__webpack_require__.e(/*! import() */ 644).then(__webpack_require__.t.bind(__webpack_require__, /*! b */ 3, 23)).then(function(b) {
+ console.log("b loaded", b);
+})
+
+function loadC(name) {
+ return __webpack_require__(2)("./" + name);
+}
+
+Promise.all([loadC("1"), loadC("2")]).then(function(arr) {
+ console.log("c/1 and c/2 loaded", arr);
+});
+
+})();
+
/******/ })()
;
```
@@ -407,7 +398,7 @@ module.exports = webpackAsyncContext;
## Unoptimized
```
-asset output.js 13.7 KiB [emitted] (name: main)
+asset output.js 13.6 KiB [emitted] (name: main)
asset 346.output.js 296 bytes [emitted]
asset 98.output.js 295 bytes [emitted]
asset 644.output.js 288 bytes [emitted]
@@ -416,11 +407,11 @@ chunk (runtime: main) 98.output.js 13 bytes [rendered]
> ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js
./node_modules/c/2.js 13 bytes [optional] [built] [code generated]
[used exports unknown]
- context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2
- context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js
-chunk (runtime: main) output.js (main) 414 bytes (javascript) 6.9 KiB (runtime) [entry] [rendered]
+ import() context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2
+ import() context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js
+chunk (runtime: main) output.js (main) 414 bytes (javascript) 6.91 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 6.9 KiB 10 modules
+ runtime modules 6.91 KiB 10 modules
dependent modules 171 bytes [dependent] 2 modules
./example.js 243 bytes [built] [code generated]
[no exports]
@@ -431,14 +422,14 @@ chunk (runtime: main) 346.output.js 13 bytes [rendered]
> ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js
./node_modules/c/1.js 13 bytes [optional] [built] [code generated]
[used exports unknown]
- context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1
- context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js
+ import() context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1
+ import() context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js
chunk (runtime: main) 644.output.js 11 bytes [rendered]
> b ./example.js 3:0-11
./node_modules/b.js 11 bytes [built] [code generated]
[used exports unknown]
import() b ./example.js 3:0-11
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -453,11 +444,11 @@ chunk (runtime: main) 98.output.js 13 bytes [rendered]
> ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js
./node_modules/c/2.js 13 bytes [optional] [built] [code generated]
[used exports unknown]
- context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2
- context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js
-chunk (runtime: main) output.js (main) 403 bytes (javascript) 6.64 KiB (runtime) [entry] [rendered]
+ import() context element ./2 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2
+ import() context element ./2.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./2.js
+chunk (runtime: main) output.js (main) 403 bytes (javascript) 6.65 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 6.64 KiB 9 modules
+ runtime modules 6.65 KiB 9 modules
dependent modules 160 bytes [dependent] 1 module
./example.js 243 bytes [built] [code generated]
[no exports]
@@ -468,12 +459,12 @@ chunk (runtime: main) 346.output.js 13 bytes [rendered]
> ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js
./node_modules/c/1.js 13 bytes [optional] [built] [code generated]
[used exports unknown]
- context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1
- context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js
+ import() context element ./1 ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1
+ import() context element ./1.js ./node_modules/c/ lazy ^\.\/.*$ namespace object ./1.js
chunk (runtime: main) 644.output.js 11 bytes [rendered]
> b ./example.js 3:0-11
./node_modules/b.js 11 bytes [built] [code generated]
[used exports unknown]
import() b ./example.js 3:0-11
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting-native-import-context-filter/README.md b/examples/code-splitting-native-import-context-filter/README.md
index 05287021f41..2eaaedfc945 100644
--- a/examples/code-splitting-native-import-context-filter/README.md
+++ b/examples/code-splitting-native-import-context-filter/README.md
@@ -98,7 +98,7 @@ function webpackAsyncContext(req) {
return __webpack_require__(id);
});
}
-webpackAsyncContext.keys = () => Object.keys(map);
+webpackAsyncContext.keys = () => (Object.keys(map));
webpackAsyncContext.id = 1;
module.exports = webpackAsyncContext;
@@ -116,8 +116,9 @@ module.exports = webpackAsyncContext;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -173,7 +174,7 @@ module.exports = webpackAsyncContext;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -181,7 +182,7 @@ module.exports = webpackAsyncContext;
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -211,10 +212,9 @@ module.exports = webpackAsyncContext;
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -244,12 +244,11 @@ module.exports = webpackAsyncContext;
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -261,9 +260,7 @@ module.exports = webpackAsyncContext;
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -285,7 +282,7 @@ module.exports = webpackAsyncContext;
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -299,39 +296,36 @@ module.exports = webpackAsyncContext;
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -340,6 +334,8 @@ module.exports = webpackAsyncContext;
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -375,10 +371,10 @@ getTemplate("baz.noimport");
## Unoptimized
```
-asset output.js 11.1 KiB [emitted] (name: main)
-asset 398.output.js 856 bytes [emitted]
-asset 544.output.js 856 bytes [emitted]
-asset 718.output.js 856 bytes [emitted]
+asset output.js 11.2 KiB [emitted] (name: main)
+asset 398.output.js 858 bytes [emitted]
+asset 544.output.js 858 bytes [emitted]
+asset 718.output.js 858 bytes [emitted]
chunk (runtime: main) output.js (main) 597 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.54 KiB 8 modules
@@ -392,25 +388,25 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered]
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar
- context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js
+ import() context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar
+ import() context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js
chunk (runtime: main) 544.output.js 38 bytes [rendered]
> ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
- context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
+ import() context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
+ import() context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
chunk (runtime: main) 718.output.js 38 bytes [rendered]
> ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
> ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
./templates/foo.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
- context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
-webpack 5.11.1 compiled successfully
+ import() context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
+ import() context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -432,21 +428,21 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered]
> ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar
- context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js
+ import() context element ./bar ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar
+ import() context element ./bar.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./bar.js
chunk (runtime: main) 544.output.js 38 bytes [rendered]
> ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
- context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
+ import() context element ./baz ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz
+ import() context element ./baz.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./baz.js
chunk (runtime: main) 718.output.js 38 bytes [rendered]
> ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
> ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
./templates/foo.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
- context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
-webpack 5.11.1 compiled successfully
+ import() context element ./foo ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo
+ import() context element ./foo.js ./templates/ lazy ^\.\/.*$ include: \.js$ exclude: \.noimport\.js$ namespace object ./foo.js
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting-native-import-context/README.md b/examples/code-splitting-native-import-context/README.md
index e530c9b9dd0..081d3de6353 100644
--- a/examples/code-splitting-native-import-context/README.md
+++ b/examples/code-splitting-native-import-context/README.md
@@ -87,7 +87,7 @@ function webpackAsyncContext(req) {
return __webpack_require__(id);
});
}
-webpackAsyncContext.keys = () => Object.keys(map);
+webpackAsyncContext.keys = () => (Object.keys(map));
webpackAsyncContext.id = 1;
module.exports = webpackAsyncContext;
@@ -105,8 +105,9 @@ module.exports = webpackAsyncContext;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -162,7 +163,7 @@ module.exports = webpackAsyncContext;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -170,7 +171,7 @@ module.exports = webpackAsyncContext;
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -200,10 +201,9 @@ module.exports = webpackAsyncContext;
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -233,12 +233,11 @@ module.exports = webpackAsyncContext;
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -250,9 +249,7 @@ module.exports = webpackAsyncContext;
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -274,7 +271,7 @@ module.exports = webpackAsyncContext;
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -288,39 +285,36 @@ module.exports = webpackAsyncContext;
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -329,6 +323,8 @@ module.exports = webpackAsyncContext;
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -362,10 +358,10 @@ getTemplate("baz");
## Unoptimized
```
-asset output.js 10.9 KiB [emitted] (name: main)
-asset 398.output.js 856 bytes [emitted]
-asset 544.output.js 856 bytes [emitted]
-asset 718.output.js 856 bytes [emitted]
+asset output.js 11 KiB [emitted] (name: main)
+asset 398.output.js 858 bytes [emitted]
+asset 544.output.js 858 bytes [emitted]
+asset 718.output.js 858 bytes [emitted]
chunk (runtime: main) output.js (main) 441 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.54 KiB 8 modules
@@ -379,25 +375,25 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered]
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar
- context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js
+ import() context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar
+ import() context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js
chunk (runtime: main) 544.output.js 38 bytes [rendered]
> ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz
- context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js
+ import() context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz
+ import() context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js
chunk (runtime: main) 718.output.js 38 bytes [rendered]
> ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo
> ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js
./templates/foo.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo
- context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js
-webpack 5.11.1 compiled successfully
+ import() context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo
+ import() context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -419,21 +415,21 @@ chunk (runtime: main) 398.output.js 38 bytes [rendered]
> ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar
- context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js
+ import() context element ./bar ./templates/ lazy ^\.\/.*$ namespace object ./bar
+ import() context element ./bar.js ./templates/ lazy ^\.\/.*$ namespace object ./bar.js
chunk (runtime: main) 544.output.js 38 bytes [rendered]
> ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz
> ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz
- context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js
+ import() context element ./baz ./templates/ lazy ^\.\/.*$ namespace object ./baz
+ import() context element ./baz.js ./templates/ lazy ^\.\/.*$ namespace object ./baz.js
chunk (runtime: main) 718.output.js 38 bytes [rendered]
> ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo
> ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js
./templates/foo.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo
- context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js
-webpack 5.11.1 compiled successfully
+ import() context element ./foo ./templates/ lazy ^\.\/.*$ namespace object ./foo
+ import() context element ./foo.js ./templates/ lazy ^\.\/.*$ namespace object ./foo.js
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting-specify-chunk-name/README.md b/examples/code-splitting-specify-chunk-name/README.md
index a14fb23cdc8..e8a17affc7d 100644
--- a/examples/code-splitting-specify-chunk-name/README.md
+++ b/examples/code-splitting-specify-chunk-name/README.md
@@ -79,7 +79,7 @@ function webpackAsyncContext(req) {
return __webpack_require__(id);
});
}
-webpackAsyncContext.keys = () => Object.keys(map);
+webpackAsyncContext.keys = () => (Object.keys(map));
webpackAsyncContext.id = 1;
module.exports = webpackAsyncContext;
@@ -97,8 +97,9 @@ module.exports = webpackAsyncContext;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -154,7 +155,7 @@ module.exports = webpackAsyncContext;
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -162,7 +163,7 @@ module.exports = webpackAsyncContext;
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -192,10 +193,9 @@ module.exports = webpackAsyncContext;
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -225,12 +225,11 @@ module.exports = webpackAsyncContext;
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -242,9 +241,7 @@ module.exports = webpackAsyncContext;
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -266,7 +263,7 @@ module.exports = webpackAsyncContext;
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -280,39 +277,36 @@ module.exports = webpackAsyncContext;
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -321,6 +315,8 @@ module.exports = webpackAsyncContext;
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -334,7 +330,7 @@ __webpack_require__.e(/*! import() | chunk-foo */ 930).then(__webpack_require__.
__webpack_require__.e(/*! require.ensure | chunk-foo1 */ 930).then((function(require) {
var foo = __webpack_require__(/*! ./templates/foo */ 2);
console.log('foo:', foo);
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
var createContextVar = "r";
__webpack_require__(1)("./ba" + createContextVar).then(function(bar) {
@@ -354,10 +350,10 @@ __webpack_require__(1)("./ba" + createContextVar).then(function(bar) {
## Unoptimized
```
-asset output.js 11.2 KiB [emitted] (name: main)
-asset 548.output.js 856 bytes [emitted] (name: chunk-bar-baz2)
-asset 791.output.js 856 bytes [emitted] (name: chunk-bar-baz0)
-asset 930.output.js 856 bytes [emitted] (name: chunk-foo)
+asset output.js 11.3 KiB [emitted] (name: main)
+asset 548.output.js 858 bytes [emitted] (name: chunk-bar-baz2)
+asset 791.output.js 858 bytes [emitted] (name: chunk-bar-baz0)
+asset 930.output.js 858 bytes [emitted] (name: chunk-foo)
chunk (runtime: main) output.js (main) 565 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.54 KiB 8 modules
@@ -371,16 +367,16 @@ chunk (runtime: main) 548.output.js (chunk-bar-baz2) 38 bytes [rendered]
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
- context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
+ import() context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
+ import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
chunk (runtime: main) 791.output.js (chunk-bar-baz0) 38 bytes [rendered]
> ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
> ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
[used exports unknown]
- context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
- context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
+ import() context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
+ import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered]
> ./templates/foo ./example.js 1:0-62
> ./example.js 5:0-8:16
@@ -389,13 +385,13 @@ chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered]
[used exports unknown]
import() ./templates/foo ./example.js 1:0-62
cjs require ./templates/foo ./example.js 6:11-37
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 2.44 KiB [emitted] [minimized] (name: main)
+asset output.js 2.45 KiB [emitted] [minimized] (name: main)
asset 548.output.js 130 bytes [emitted] [minimized] (name: chunk-bar-baz2)
asset 791.output.js 130 bytes [emitted] [minimized] (name: chunk-bar-baz0)
asset 930.output.js 130 bytes [emitted] [minimized] (name: chunk-foo)
@@ -411,15 +407,15 @@ chunk (runtime: main) 548.output.js (chunk-bar-baz2) 38 bytes [rendered]
> ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
./templates/baz.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
- context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
+ import() context element ./baz ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz
+ import() context element ./baz.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./baz.js
chunk (runtime: main) 791.output.js (chunk-bar-baz0) 38 bytes [rendered]
> ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
> ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
./templates/bar.js 38 bytes [optional] [built] [code generated]
[exports: default]
- context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
- context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
+ import() context element ./bar ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar
+ import() context element ./bar.js ./templates/ lazy ^\.\/ba.*$ chunkName: chunk-bar-baz namespace object ./bar.js
chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered]
> ./templates/foo ./example.js 1:0-62
> ./example.js 5:0-8:16
@@ -427,5 +423,5 @@ chunk (runtime: main) 930.output.js (chunk-foo) 38 bytes [rendered]
[exports: default]
import() ./templates/foo ./example.js 1:0-62
cjs require ./templates/foo ./example.js 6:11-37
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/code-splitting/README.md b/examples/code-splitting/README.md
index d1391a9375b..1666ba4800b 100644
--- a/examples/code-splitting/README.md
+++ b/examples/code-splitting/README.md
@@ -75,8 +75,9 @@ require.ensure(["c"], function(require) {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -120,7 +121,7 @@ require.ensure(["c"], function(require) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -128,7 +129,7 @@ require.ensure(["c"], function(require) {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -158,10 +159,9 @@ require.ensure(["c"], function(require) {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -180,12 +180,11 @@ require.ensure(["c"], function(require) {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -197,9 +196,7 @@ require.ensure(["c"], function(require) {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -221,7 +218,7 @@ require.ensure(["c"], function(require) {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -235,39 +232,36 @@ require.ensure(["c"], function(require) {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -276,6 +270,8 @@ require.ensure(["c"], function(require) {
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -285,9 +281,9 @@ require.ensure(["c"], function(require) {
var a = __webpack_require__(/*! a */ 1);
var b = __webpack_require__(/*! b */ 2);
__webpack_require__.e(/*! require.ensure */ 796).then((function(require) {
- __webpack_require__(/*! b */ 2).xyz();
+ (__webpack_require__(/*! b */ 2).xyz)();
var d = __webpack_require__(/*! d */ 4);
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
})();
/******/ })()
@@ -337,7 +333,7 @@ Minimized
## Unoptimized
```
-asset output.js 9.37 KiB [emitted] (name: main)
+asset output.js 9.47 KiB [emitted] (name: main)
asset 796.output.js 528 bytes [emitted]
chunk (runtime: main) output.js (main) 161 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered]
> ./example.js main
@@ -354,7 +350,7 @@ chunk (runtime: main) 796.output.js 22 bytes [rendered]
./node_modules/d.js 11 bytes [built] [code generated]
[used exports unknown]
cjs require d ./example.js 5:12-24
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -377,5 +373,5 @@ chunk (runtime: main) 796.output.js 22 bytes [rendered]
./node_modules/d.js 11 bytes [built] [code generated]
[used exports unknown]
cjs require d ./example.js 5:12-24
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/coffee-script/README.md b/examples/coffee-script/README.md
index 270fea3e54c..b3f899c6f0b 100644
--- a/examples/coffee-script/README.md
+++ b/examples/coffee-script/README.md
@@ -74,8 +74,9 @@ module.exports = 42;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -97,6 +98,8 @@ module.exports = 42;
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -115,25 +118,25 @@ console.log(__webpack_require__(/*! ./cup1 */ 1));
## Unoptimized
```
-asset output.js 2.09 KiB [emitted] (name: main)
+asset output.js 2.27 KiB [emitted] (name: main)
chunk (runtime: main) output.js (main) 206 bytes [entry] [rendered]
> ./example.js main
dependent modules 175 bytes [dependent] 2 modules
./example.js 31 bytes [built] [code generated]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 280 bytes [emitted] [minimized] (name: main)
+asset output.js 294 bytes [emitted] [minimized] (name: main)
chunk (runtime: main) output.js (main) 206 bytes [entry] [rendered]
> ./example.js main
dependent modules 175 bytes [dependent] 2 modules
./example.js 31 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/coffee-script/webpack.config.js b/examples/coffee-script/webpack.config.js
index 845f9f4c190..91c59cf45a7 100644
--- a/examples/coffee-script/webpack.config.js
+++ b/examples/coffee-script/webpack.config.js
@@ -1,5 +1,5 @@
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
module: {
rules: [
{
diff --git a/examples/common-chunk-and-vendor-chunk/README.md b/examples/common-chunk-and-vendor-chunk/README.md
index 8434b15379f..8346e48a620 100644
--- a/examples/common-chunk-and-vendor-chunk/README.md
+++ b/examples/common-chunk-and-vendor-chunk/README.md
@@ -194,8 +194,9 @@ module.exports = "utility1";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -214,13 +215,42 @@ module.exports = "utility1";
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
@@ -229,14 +259,11 @@ module.exports = "utility1";
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "pageA": 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/ [0,"vendor","commons-utility2_js"]
-/******/ ];
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
@@ -247,69 +274,36 @@ module.exports = "utility1";
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -318,8 +312,13 @@ module.exports = "utility1";
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module depends on other loaded chunks and execution need to be delayed
+/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendor","commons-utility2_js"], () => (__webpack_require__(0)))
+/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
+/******/
/******/ })()
;
```
@@ -361,8 +360,9 @@ module.exports = "pageB";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -381,13 +381,42 @@ module.exports = "pageB";
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
@@ -396,14 +425,11 @@ module.exports = "pageB";
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "pageB": 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/ [4,"vendor","commons-utility2_js","commons-utility3_js"]
-/******/ ];
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
@@ -414,69 +440,36 @@ module.exports = "pageB";
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -485,8 +478,13 @@ module.exports = "pageB";
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module depends on other loaded chunks and execution need to be delayed
+/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["vendor","commons-utility2_js","commons-utility3_js"], () => (__webpack_require__(4)))
+/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
+/******/
/******/ })()
;
```
@@ -526,8 +524,9 @@ module.exports = "pageC";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -546,13 +545,42 @@ module.exports = "pageC";
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/jsonp chunk loading */
@@ -561,14 +589,11 @@ module.exports = "pageC";
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "pageC": 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/ [7,"commons-utility2_js","commons-utility3_js"]
-/******/ ];
/******/ // no chunk on demand loading
/******/
/******/ // no prefetching
@@ -579,69 +604,36 @@ module.exports = "pageC";
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -650,8 +642,13 @@ module.exports = "pageC";
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module depends on other loaded chunks and execution need to be delayed
+/******/ var __webpack_exports__ = __webpack_require__.O(undefined, ["commons-utility2_js","commons-utility3_js"], () => (__webpack_require__(7)))
+/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
+/******/
/******/ })()
;
```
@@ -664,13 +661,13 @@ module.exports = "pageC";
assets by chunk 768 bytes (id hint: commons)
asset commons-utility2_js.js 384 bytes [emitted] (id hint: commons)
asset commons-utility3_js.js 384 bytes [emitted] (id hint: commons)
-asset pageA.js 6 KiB [emitted] (name: pageA)
-asset pageB.js 5.73 KiB [emitted] (name: pageB)
-asset pageC.js 5.67 KiB [emitted] (name: pageC)
+asset pageA.js 6.07 KiB [emitted] (name: pageA)
+asset pageB.js 5.8 KiB [emitted] (name: pageB)
+asset pageC.js 5.74 KiB [emitted] (name: pageC)
asset vendor.js 737 bytes [emitted] (name: vendor) (id hint: vendor)
-Entrypoint pageA 7.09 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes pageA.js 6 KiB
-Entrypoint pageB 7.2 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageB.js 5.73 KiB
-Entrypoint pageC 6.42 KiB = commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageC.js 5.67 KiB
+Entrypoint pageA 7.17 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes pageA.js 6.07 KiB
+Entrypoint pageB 7.27 KiB = vendor.js 737 bytes commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageB.js 5.8 KiB
+Entrypoint pageC 6.49 KiB = commons-utility2_js.js 384 bytes commons-utility3_js.js 384 bytes pageC.js 5.74 KiB
chunk (runtime: pageA, pageB, pageC) commons-utility2_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons)
> ./pageA pageA
> ./pageB pageB
@@ -689,24 +686,24 @@ chunk (runtime: pageB, pageC) commons-utility3_js.js (id hint: commons) 28 bytes
cjs require ./utility3 ./pageB.js 3:15-36
cjs require ./utility3 ./pageC.js 2:15-36
cjs self exports reference ./utility3.js 1:0-14
-chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.6 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered]
> ./pageA pageA
- runtime modules 2.6 KiB 2 modules
+ runtime modules 2.46 KiB 3 modules
dependent modules 28 bytes [dependent] 1 module
./pageA.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageA.js 5:0-14
entry ./pageA pageA
-chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.62 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered]
> ./pageB pageB
- runtime modules 2.62 KiB 2 modules
+ runtime modules 2.46 KiB 3 modules
./pageB.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageB.js 5:0-14
entry ./pageB pageB
-chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.61 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered]
> ./pageC pageC
- runtime modules 2.61 KiB 2 modules
+ runtime modules 2.46 KiB 3 modules
./pageC.js 102 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageC.js 4:0-14
@@ -722,7 +719,7 @@ chunk (runtime: pageA, pageB) vendor.js (vendor) (id hint: vendor) 54 bytes [ini
[used exports unknown]
cjs self exports reference ./node_modules/vendor2.js 1:0-14
cjs require vendor2 ./pageB.js 1:14-32
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -731,13 +728,13 @@ webpack 5.11.1 compiled successfully
assets by chunk 212 bytes (id hint: commons)
asset commons-utility2_js.js 106 bytes [emitted] [minimized] (id hint: commons)
asset commons-utility3_js.js 106 bytes [emitted] [minimized] (id hint: commons)
-asset pageA.js 907 bytes [emitted] [minimized] (name: pageA)
-asset pageB.js 899 bytes [emitted] [minimized] (name: pageB)
-asset pageC.js 883 bytes [emitted] [minimized] (name: pageC)
+asset pageA.js 1 KiB [emitted] [minimized] (name: pageA)
+asset pageB.js 1020 bytes [emitted] [minimized] (name: pageB)
+asset pageC.js 1010 bytes [emitted] [minimized] (name: pageC)
asset vendor.js 121 bytes [emitted] [minimized] (name: vendor) (id hint: vendor)
-Entrypoint pageA 1.11 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes pageA.js 907 bytes
-Entrypoint pageB 1.2 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageB.js 899 bytes
-Entrypoint pageC 1.07 KiB = commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageC.js 883 bytes
+Entrypoint pageA 1.23 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes pageA.js 1 KiB
+Entrypoint pageB 1.32 KiB = vendor.js 121 bytes commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageB.js 1020 bytes
+Entrypoint pageC 1.19 KiB = commons-utility2_js.js 106 bytes commons-utility3_js.js 106 bytes pageC.js 1010 bytes
chunk (runtime: pageA, pageB, pageC) commons-utility2_js.js (id hint: commons) 28 bytes [initial] [rendered] split chunk (cache group: commons)
> ./pageA pageA
> ./pageB pageB
@@ -756,24 +753,24 @@ chunk (runtime: pageB, pageC) commons-utility3_js.js (id hint: commons) 28 bytes
cjs require ./utility3 ./pageB.js 3:15-36
cjs require ./utility3 ./pageC.js 2:15-36
cjs self exports reference ./utility3.js 1:0-14
-chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.6 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageA) pageA.js (pageA) 165 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered]
> ./pageA pageA
- runtime modules 2.6 KiB 2 modules
+ runtime modules 2.46 KiB 3 modules
dependent modules 28 bytes [dependent] 1 module
./pageA.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageA.js 5:0-14
entry ./pageA pageA
-chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.63 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageB) pageB.js (pageB) 137 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered]
> ./pageB pageB
- runtime modules 2.63 KiB 2 modules
+ runtime modules 2.46 KiB 3 modules
./pageB.js 137 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageB.js 5:0-14
entry ./pageB pageB
-chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.62 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageC) pageC.js (pageC) 102 bytes (javascript) 2.46 KiB (runtime) [entry] [rendered]
> ./pageC pageC
- runtime modules 2.62 KiB 2 modules
+ runtime modules 2.46 KiB 3 modules
./pageC.js 102 bytes [built] [code generated]
[used exports unknown]
cjs self exports reference ./pageC.js 4:0-14
@@ -789,5 +786,5 @@ chunk (runtime: pageA, pageB) vendor.js (vendor) (id hint: vendor) 54 bytes [ini
[used exports unknown]
cjs self exports reference ./node_modules/vendor2.js 1:0-14
cjs require vendor2 ./pageB.js 1:14-32
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/common-chunk-and-vendor-chunk/webpack.config.js b/examples/common-chunk-and-vendor-chunk/webpack.config.js
index 98d8fdec608..e28ea6b8f53 100644
--- a/examples/common-chunk-and-vendor-chunk/webpack.config.js
+++ b/examples/common-chunk-and-vendor-chunk/webpack.config.js
@@ -1,4 +1,4 @@
-var path = require("path");
+const path = require("path");
module.exports = {
// mode: "development" || "production",
diff --git a/examples/common-chunk-grandchildren/README.md b/examples/common-chunk-grandchildren/README.md
index b4491f7dfcd..b2827e37830 100644
--- a/examples/common-chunk-grandchildren/README.md
+++ b/examples/common-chunk-grandchildren/README.md
@@ -86,7 +86,7 @@ module.exports = function() {
const path = require("path");
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
main: ["./example.js"]
},
@@ -120,8 +120,9 @@ module.exports = {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -165,7 +166,7 @@ module.exports = {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -173,7 +174,7 @@ module.exports = {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -203,10 +204,9 @@ module.exports = {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -225,12 +225,11 @@ module.exports = {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -242,9 +241,7 @@ module.exports = {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -266,7 +263,7 @@ module.exports = {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -280,39 +277,36 @@ module.exports = {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -321,6 +315,7 @@ module.exports = {
``` js
+var __webpack_exports__ = {};
/*!********************!*\
!*** ./example.js ***!
\********************/
@@ -331,11 +326,11 @@ var main = function() {
Promise.all(/*! require.ensure */[__webpack_require__.e(421), __webpack_require__.e(366)]).then((() => {
const page = __webpack_require__(/*! ./pageA */ 1);
page();
- }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+ }).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
__webpack_require__.e(/*! require.ensure */ 588).then((() => {
const page = __webpack_require__(/*! ./pageB */ 3);
page();
- }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+ }).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
};
main();
@@ -389,7 +384,7 @@ module.exports = function() {
Promise.all(/*! require.ensure */[__webpack_require__.e(421), __webpack_require__.e(145)]).then((()=>{
const page = __webpack_require__(/*! ./pageC */ 4);
page();
- }).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+ }).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
};
@@ -454,8 +449,8 @@ module.exports = function() {
## Unoptimized
```
-asset output.js 9.1 KiB [emitted] (name: main)
-asset 588.output.js 736 bytes [emitted]
+asset output.js 9.09 KiB [emitted] (name: main)
+asset 588.output.js 739 bytes [emitted]
asset 366.output.js 558 bytes [emitted]
asset 145.output.js 552 bytes [emitted]
asset 421.output.js 434 bytes [emitted]
@@ -491,7 +486,7 @@ chunk (runtime: main) 588.output.js 133 bytes [rendered]
[used exports unknown]
cjs require ./pageB ./example.js 8:15-33
cjs self exports reference ./pageB.js 1:0-14
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -534,5 +529,5 @@ chunk (runtime: main) 588.output.js 133 bytes [rendered]
[used exports unknown]
cjs require ./pageB ./example.js 8:15-33
cjs self exports reference ./pageB.js 1:0-14
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/common-chunk-grandchildren/webpack.config.js b/examples/common-chunk-grandchildren/webpack.config.js
index e8c14e818d9..ea9fdf2323e 100644
--- a/examples/common-chunk-grandchildren/webpack.config.js
+++ b/examples/common-chunk-grandchildren/webpack.config.js
@@ -2,7 +2,7 @@
const path = require("path");
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
main: ["./example.js"]
},
diff --git a/examples/commonjs/README.md b/examples/commonjs/README.md
index 06efad94f70..c5074df2659 100644
--- a/examples/commonjs/README.md
+++ b/examples/commonjs/README.md
@@ -51,7 +51,7 @@ exports.add = function() {
/*! runtime requirements: __webpack_require__, __webpack_exports__ */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
-const add = __webpack_require__(/*! ./math */ 2).add;
+const add = (__webpack_require__(/*! ./math */ 2).add);
exports.increment = function(val) {
return add(val, 1);
};
@@ -90,8 +90,9 @@ exports.add = function() {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -113,13 +114,15 @@ exports.add = function() {
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
\********************/
/*! unknown exports (runtime-defined) */
/*! runtime requirements: __webpack_require__ */
-const inc = __webpack_require__(/*! ./increment */ 1).increment;
+const inc = (__webpack_require__(/*! ./increment */ 1).increment);
const a = 1;
inc(a); // 2
@@ -134,25 +137,25 @@ inc(a); // 2
## Unoptimized
```
-asset output.js 2.34 KiB [emitted] (name: main)
+asset output.js 2.52 KiB [emitted] (name: main)
chunk (runtime: main) output.js (main) 326 bytes [entry] [rendered]
> ./example.js main
dependent modules 254 bytes [dependent] 2 modules
./example.js 72 bytes [built] [code generated]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 296 bytes [emitted] [minimized] (name: main)
+asset output.js 310 bytes [emitted] [minimized] (name: main)
chunk (runtime: main) output.js (main) 326 bytes [entry] [rendered]
> ./example.js main
dependent modules 254 bytes [dependent] 2 modules
./example.js 72 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/css/README.md b/examples/css/README.md
new file mode 100644
index 00000000000..0d2411cb7ae
--- /dev/null
+++ b/examples/css/README.md
@@ -0,0 +1,559 @@
+# example.js
+
+```javascript
+import "./style.css";
+import "./style2.css";
+import { main } from "./style.module.css";
+import("./lazy-style.css");
+
+document.getElementsByTagName("main")[0].className = main;
+```
+
+# style.css
+
+```javascript
+@import "style-imported.css";
+@import "https://fonts.googleapis.com/css?family=Open+Sans";
+
+body {
+ background: green;
+ font-family: "Open Sans";
+}
+```
+
+# dist/output.js
+
+```javascript
+/******/ (() => { // webpackBootstrap
+/******/ "use strict";
+/******/ var __webpack_modules__ = ({
+
+/***/ 3:
+/*!*************************!*\
+ !*** ./images/file.png ***!
+ \*************************/
+/*! default exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__.p, module, __webpack_require__.* */
+/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
+
+module.exports = __webpack_require__.p + "89a353e9c515885abd8e.png";
+
+/***/ })
+
+/******/ });
+```
+
+/* webpack runtime code */
+
+``` js
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = __webpack_modules__;
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/ensure chunk */
+/******/ (() => {
+/******/ __webpack_require__.f = {};
+/******/ // This file contains only the entry chunk.
+/******/ // The chunk loading function for additional chunks
+/******/ __webpack_require__.e = (chunkId) => {
+/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
+/******/ __webpack_require__.f[key](chunkId, promises);
+/******/ return promises;
+/******/ }, []));
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/get css chunk filename */
+/******/ (() => {
+/******/ // This function allow to reference async chunks
+/******/ __webpack_require__.k = (chunkId) => {
+/******/ // return url for filenames based on template
+/******/ return "" + chunkId + ".output.css";
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/get javascript chunk filename */
+/******/ (() => {
+/******/ // This function allow to reference async chunks
+/******/ __webpack_require__.u = (chunkId) => {
+/******/ // return url for filenames based on template
+/******/ return "" + chunkId + ".output.js";
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ (() => {
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
+/******/ })();
+/******/
+/******/ /* webpack/runtime/load script */
+/******/ (() => {
+/******/ var inProgress = {};
+/******/ var dataWebpackPrefix = "app:";
+/******/ // loadScript function to load a script via script tag
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
+/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
+/******/ var script, needAttach;
+/******/ if(key !== undefined) {
+/******/ var scripts = document.getElementsByTagName("script");
+/******/ for(var i = 0; i < scripts.length; i++) {
+/******/ var s = scripts[i];
+/******/ if(s.getAttribute("src") == url || s.getAttribute("data-webpack") == dataWebpackPrefix + key) { script = s; break; }
+/******/ }
+/******/ }
+/******/ if(!script) {
+/******/ needAttach = true;
+/******/ script = document.createElement('script');
+/******/
+/******/ script.charset = 'utf-8';
+/******/ script.timeout = 120;
+/******/ if (__webpack_require__.nc) {
+/******/ script.setAttribute("nonce", __webpack_require__.nc);
+/******/ }
+/******/ script.setAttribute("data-webpack", dataWebpackPrefix + key);
+/******/ script.src = url;
+/******/ }
+/******/ inProgress[url] = [done];
+/******/ var onScriptComplete = (prev, event) => {
+/******/ // avoid mem leaks in IE.
+/******/ script.onerror = script.onload = null;
+/******/ clearTimeout(timeout);
+/******/ var doneFns = inProgress[url];
+/******/ delete inProgress[url];
+/******/ script.parentNode && script.parentNode.removeChild(script);
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
+/******/ if(prev) return prev(event);
+/******/ }
+/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
+/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
+/******/ script.onload = onScriptComplete.bind(null, script.onload);
+/******/ needAttach && document.head.appendChild(script);
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ (() => {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = (exports) => {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/publicPath */
+/******/ (() => {
+/******/ __webpack_require__.p = "dist/";
+/******/ })();
+/******/
+/******/ /* webpack/runtime/css loading */
+/******/ (() => {
+/******/ // object to store loaded and loading chunks
+/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
+/******/ var installedChunks = {};
+/******/
+/******/ var uniqueName = "app";
+/******/ var loadCssChunkData = (target, link, chunkId) => {
+/******/ var data, token = "", token2, exports = {}, exportsWithId = [], exportsWithDashes = [], i = 0, cc = 1;
+/******/ try { if(!link) link = loadStylesheet(chunkId); data = link.sheet.cssRules; data = data[data.length - 1].style; } catch(e) { data = getComputedStyle(document.head); }
+/******/ data = data.getPropertyValue("--webpack-" + uniqueName + "-" + chunkId);
+/******/ if(!data) return [];
+/******/ for(; cc; i++) {
+/******/ cc = data.charCodeAt(i);
+/******/ if(cc == 40) { token2 = token; token = ""; }
+/******/ else if(cc == 41) { exports[token2.replace(/^_/, "")] = token.replace(/^_/, ""); token = ""; }
+/******/ else if(cc == 47 || cc == 37) { token = token.replace(/^_/, ""); exports[token] = token; exportsWithId.push(token); if(cc == 37) exportsWithDashes.push(token); token = ""; }
+/******/ else if(!cc || cc == 44) { token = token.replace(/^_/, ""); exportsWithId.forEach((x) => (exports[x] = uniqueName + "-" + token + "-" + exports[x])); exportsWithDashes.forEach((x) => (exports[x] = "--" + exports[x])); __webpack_require__.r(exports); target[token] = ((exports, module) => {
+/******/ module.exports = exports;
+/******/ }).bind(null, exports); token = ""; exports = {}; exportsWithId.length = 0; }
+/******/ else if(cc == 92) { token += data[++i] }
+/******/ else { token += data[i]; }
+/******/ }
+/******/ installedChunks[chunkId] = 0;
+/******/
+/******/ }
+/******/ var loadingAttribute = "data-webpack-loading";
+/******/ var loadStylesheet = (chunkId, url, done) => {
+/******/ var link, needAttach, key = "chunk-" + chunkId;
+/******/
+/******/ var links = document.getElementsByTagName("link");
+/******/ for(var i = 0; i < links.length; i++) {
+/******/ var l = links[i];
+/******/ if(l.rel == "stylesheet" && (l.href == url || l.getAttribute("href") == url || l.getAttribute("data-webpack") == uniqueName + ":" + key)) { link = l; break; }
+/******/ }
+/******/ if(!done) return link;
+/******/
+/******/ if(!link) {
+/******/ needAttach = true;
+/******/ link = document.createElement('link');
+/******/ link.setAttribute("data-webpack", uniqueName + ":" + key);
+/******/ link.setAttribute(loadingAttribute, 1);
+/******/ link.rel = "stylesheet";
+/******/ link.href = url;
+/******/ }
+/******/ var onLinkComplete = (prev, event) => {
+/******/ link.onerror = link.onload = null;
+/******/ link.removeAttribute(loadingAttribute);
+/******/ clearTimeout(timeout);
+/******/ if(event && event.type != "load") link.parentNode.removeChild(link)
+/******/ done(event);
+/******/ if(prev) return prev(event);
+/******/ };
+/******/ if(link.getAttribute(loadingAttribute)) {
+/******/ var timeout = setTimeout(onLinkComplete.bind(null, undefined, { type: 'timeout', target: link }), 120000);
+/******/ link.onerror = onLinkComplete.bind(null, link.onerror);
+/******/ link.onload = onLinkComplete.bind(null, link.onload);
+/******/ } else onLinkComplete(undefined, { type: 'load', target: link });
+/******/
+/******/ needAttach && document.head.appendChild(link);
+/******/ return link;
+/******/ };
+/******/ loadCssChunkData(__webpack_require__.m, 0, 0);
+/******/
+/******/ __webpack_require__.f.css = (chunkId, promises) => {
+/******/ // css chunk loading
+/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
+/******/ if(installedChunkData !== 0) { // 0 means "already installed".
+/******/
+/******/ // a Promise means "currently loading".
+/******/ if(installedChunkData) {
+/******/ promises.push(installedChunkData[2]);
+/******/ } else {
+/******/ if(true) { // all chunks have CSS
+/******/ // setup Promise in chunk cache
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
+/******/ promises.push(installedChunkData[2] = promise);
+/******/
+/******/ // start chunk loading
+/******/ var url = __webpack_require__.p + __webpack_require__.k(chunkId);
+/******/ // create error before stack unwound to get useful stacktrace later
+/******/ var error = new Error();
+/******/ var loadingEnded = (event) => {
+/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
+/******/ installedChunkData = installedChunks[chunkId];
+/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
+/******/ if(installedChunkData) {
+/******/ if(event.type !== "load") {
+/******/ var errorType = event && event.type;
+/******/ var realSrc = event && event.target && event.target.src;
+/******/ error.message = 'Loading css chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
+/******/ error.name = 'ChunkLoadError';
+/******/ error.type = errorType;
+/******/ error.request = realSrc;
+/******/ installedChunkData[1](error);
+/******/ } else {
+/******/ loadCssChunkData(__webpack_require__.m, link, chunkId);
+/******/ installedChunkData[0]();
+/******/ }
+/******/ }
+/******/ }
+/******/ };
+/******/ var link = loadStylesheet(chunkId, url, loadingEnded);
+/******/ } else installedChunks[chunkId] = 0;
+/******/ }
+/******/ }
+/******/ };
+/******/
+/******/ // no hmr
+/******/ })();
+/******/
+/******/ /* webpack/runtime/jsonp chunk loading */
+/******/ (() => {
+/******/ // no baseURI
+/******/
+/******/ // object to store loaded and loading chunks
+/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
+/******/ var installedChunks = {
+/******/ 0: 0
+/******/ };
+/******/
+/******/ __webpack_require__.f.j = (chunkId, promises) => {
+/******/ // JSONP chunk loading for javascript
+/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
+/******/ if(installedChunkData !== 0) { // 0 means "already installed".
+/******/
+/******/ // a Promise means "currently loading".
+/******/ if(installedChunkData) {
+/******/ promises.push(installedChunkData[2]);
+/******/ } else {
+/******/ if(0 == chunkId) {
+/******/ // setup Promise in chunk cache
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
+/******/ promises.push(installedChunkData[2] = promise);
+/******/
+/******/ // start chunk loading
+/******/ var url = __webpack_require__.p + __webpack_require__.u(chunkId);
+/******/ // create error before stack unwound to get useful stacktrace later
+/******/ var error = new Error();
+/******/ var loadingEnded = (event) => {
+/******/ if(__webpack_require__.o(installedChunks, chunkId)) {
+/******/ installedChunkData = installedChunks[chunkId];
+/******/ if(installedChunkData !== 0) installedChunks[chunkId] = undefined;
+/******/ if(installedChunkData) {
+/******/ var errorType = event && (event.type === 'load' ? 'missing' : event.type);
+/******/ var realSrc = event && event.target && event.target.src;
+/******/ error.message = 'Loading chunk ' + chunkId + ' failed.\n(' + errorType + ': ' + realSrc + ')';
+/******/ error.name = 'ChunkLoadError';
+/******/ error.type = errorType;
+/******/ error.request = realSrc;
+/******/ installedChunkData[1](error);
+/******/ }
+/******/ }
+/******/ };
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
+/******/ } else installedChunks[chunkId] = 0;
+/******/ }
+/******/ }
+/******/ };
+/******/
+/******/ // no prefetching
+/******/
+/******/ // no preloaded
+/******/
+/******/ // no HMR
+/******/
+/******/ // no HMR manifest
+/******/
+/******/ // no on chunks loaded
+/******/
+/******/ // install a JSONP callback for chunk loading
+/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
+/******/ var [chunkIds, moreModules, runtime] = data;
+/******/ // add "moreModules" to the modules object,
+/******/ // then flag all "chunkIds" as loaded and fire callback
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
+/******/ for(;i < chunkIds.length; i++) {
+/******/ chunkId = chunkIds[i];
+/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
+/******/ installedChunks[chunkId][0]();
+/******/ }
+/******/ installedChunks[chunkId] = 0;
+/******/ }
+/******/
+/******/ }
+/******/
+/******/ var chunkLoadingGlobal = self["webpackChunkapp"] = self["webpackChunkapp"] || [];
+/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
+/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
+/******/ })();
+/******/
+/************************************************************************/
+```
+
+
+
+``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+(() => {
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.e, __webpack_require__.* */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _style_css__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./style.css */ 1);
+/* harmony import */ var _style2_css__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./style2.css */ 5);
+/* harmony import */ var _style_module_css__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./style.module.css */ 6);
+
+
+
+__webpack_require__.e(/*! import() */ 1).then(__webpack_require__.bind(__webpack_require__, /*! ./lazy-style.css */ 7));
+
+document.getElementsByTagName("main")[0].className = _style_module_css__WEBPACK_IMPORTED_MODULE_2__.main;
+
+})();
+
+/******/ })()
+;
+```
+
+# dist/output.css
+
+```javascript
+@import url("https://fonts.googleapis.com/css?family=Open+Sans");
+.img {
+ width: 150px;
+ height: 150px;
+ background: url(89a353e9c515885abd8e.png);
+}
+
+
+body {
+ background: green;
+ font-family: "Open Sans";
+}
+
+body {
+ background: red;
+}
+
+:root {
+ --app-6-large: 72px;
+}
+
+.app-6-main {
+ font-size: var(--app-6-large);
+ color: darkblue;
+}
+
+@media (min-width: 1024px) {
+ .app-6-main {
+ color: green;
+ }
+}
+
+@supports (display: grid) {
+ .app-6-main {
+ display: grid
+ }
+}
+
+head{--webpack-app-0:_4,_2,_1,_5,large%main/_6;}
+```
+
+## production
+
+```javascript
+@import url("https://fonts.googleapis.com/css?family=Open+Sans");
+.img {
+ width: 150px;
+ height: 150px;
+ background: url(89a353e9c515885abd8e.png);
+}
+
+
+body {
+ background: green;
+ font-family: "Open Sans";
+}
+
+body {
+ background: red;
+}
+
+:root {
+ --app-491-b: 72px;
+}
+
+.app-491-D {
+ font-size: var(--app-491-b);
+ color: darkblue;
+}
+
+@media (min-width: 1024px) {
+ .app-491-D {
+ color: green;
+ }
+}
+
+@supports (display: grid) {
+ .app-491-D {
+ display: grid
+ }
+}
+
+head{--webpack-app-179:_548,_431,_258,_268,b%D/_491;}
+```
+
+# dist/1.output.css
+
+```javascript
+body {
+ color: blue;
+}
+
+head{--webpack-app-1:_7;}
+```
+
+# Info
+
+## Unoptimized
+
+```
+assets by chunk 17 KiB (name: main)
+ asset output.js 16.5 KiB [emitted] (name: main)
+ asset output.css 516 bytes [emitted] (name: main)
+asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
+asset 1.output.css 49 bytes [emitted]
+Entrypoint main 17 KiB (14.6 KiB) = output.js 16.5 KiB output.css 516 bytes 1 auxiliary asset
+chunk (runtime: main) output.js, output.css (main) 218 bytes (javascript) 454 bytes (css) 14.6 KiB (asset) 42 bytes (css-import) 10 KiB (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 10 KiB 9 modules
+ dependent modules 42 bytes (javascript) 14.6 KiB (asset) 454 bytes (css) 42 bytes (css-import) [dependent] 6 modules
+ ./example.js 176 bytes [built] [code generated]
+ [no exports]
+ [used exports unknown]
+ entry ./example.js main
+chunk (runtime: main) 1.output.css 23 bytes
+ > ./lazy-style.css ./example.js 4:0-26
+ ./lazy-style.css 23 bytes [built] [code generated]
+ [no exports]
+ [used exports unknown]
+ import() ./lazy-style.css ./example.js 4:0-26
+webpack 5.78.0 compiled successfully
+```
+
+## Production mode
+
+```
+assets by chunk 4.38 KiB (name: main)
+ asset output.js 3.88 KiB [emitted] [minimized] (name: main)
+ asset output.css 514 bytes [emitted] (name: main)
+asset 89a353e9c515885abd8e.png 14.6 KiB [emitted] [immutable] [from: images/file.png] (auxiliary name: main)
+asset 159.output.css 53 bytes [emitted]
+Entrypoint main 4.38 KiB (14.6 KiB) = output.js 3.88 KiB output.css 514 bytes 1 auxiliary asset
+chunk (runtime: main) 159.output.css 23 bytes
+ > ./lazy-style.css ./example.js 4:0-26
+ ./lazy-style.css 23 bytes [built] [code generated]
+ [no exports]
+ import() ./lazy-style.css ./example.js 4:0-26
+chunk (runtime: main) output.js, output.css (main) 218 bytes (javascript) 454 bytes (css) 14.6 KiB (asset) 42 bytes (css-import) 10 KiB (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 10 KiB 9 modules
+ dependent modules 42 bytes (javascript) 14.6 KiB (asset) 454 bytes (css) 42 bytes (css-import) [dependent] 6 modules
+ ./example.js 176 bytes [built] [code generated]
+ [no exports]
+ [no exports used]
+ entry ./example.js main
+webpack 5.78.0 compiled successfully
+```
diff --git a/examples/css/build.js b/examples/css/build.js
new file mode 100644
index 00000000000..41c29c9d169
--- /dev/null
+++ b/examples/css/build.js
@@ -0,0 +1 @@
+require("../build-common");
\ No newline at end of file
diff --git a/examples/css/example.js b/examples/css/example.js
new file mode 100644
index 00000000000..b44731310a8
--- /dev/null
+++ b/examples/css/example.js
@@ -0,0 +1,6 @@
+import "./style.css";
+import "./style2.css";
+import { main } from "./style.module.css";
+import("./lazy-style.css");
+
+document.getElementsByTagName("main")[0].className = main;
diff --git a/examples/css/images/file.png b/examples/css/images/file.png
new file mode 100644
index 00000000000..fb53b9dedd3
Binary files /dev/null and b/examples/css/images/file.png differ
diff --git a/examples/css/index.html b/examples/css/index.html
new file mode 100644
index 00000000000..9b3f06397ab
--- /dev/null
+++ b/examples/css/index.html
@@ -0,0 +1,10 @@
+
+
+
+
+
+ Hello World
+
+
+
+
diff --git a/examples/css/lazy-style.css b/examples/css/lazy-style.css
new file mode 100644
index 00000000000..36505138bc9
--- /dev/null
+++ b/examples/css/lazy-style.css
@@ -0,0 +1,3 @@
+body {
+ color: blue;
+}
diff --git a/examples/css/style-imported.css b/examples/css/style-imported.css
new file mode 100644
index 00000000000..83989315ce2
--- /dev/null
+++ b/examples/css/style-imported.css
@@ -0,0 +1,5 @@
+.img {
+ width: 150px;
+ height: 150px;
+ background: url("./images/file.png");
+}
diff --git a/examples/css/style.css b/examples/css/style.css
new file mode 100644
index 00000000000..8b855420284
--- /dev/null
+++ b/examples/css/style.css
@@ -0,0 +1,7 @@
+@import "style-imported.css";
+@import "https://fonts.googleapis.com/css?family=Open+Sans";
+
+body {
+ background: green;
+ font-family: "Open Sans";
+}
diff --git a/examples/css/style.module.css b/examples/css/style.module.css
new file mode 100644
index 00000000000..a788746a1a3
--- /dev/null
+++ b/examples/css/style.module.css
@@ -0,0 +1,20 @@
+:root {
+ --large: 72px;
+}
+
+.main {
+ font-size: var(--large);
+ color: darkblue;
+}
+
+@media (min-width: 1024px) {
+ .main {
+ color: green;
+ }
+}
+
+@supports (display: grid) {
+ .main {
+ display: grid
+ }
+}
diff --git a/examples/css/style2.css b/examples/css/style2.css
new file mode 100644
index 00000000000..f0d5b13bffd
--- /dev/null
+++ b/examples/css/style2.css
@@ -0,0 +1,3 @@
+body {
+ background: red;
+}
diff --git a/examples/css/template.md b/examples/css/template.md
new file mode 100644
index 00000000000..6dea2beb4e5
--- /dev/null
+++ b/examples/css/template.md
@@ -0,0 +1,49 @@
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# style.css
+
+```javascript
+_{{style.css}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# dist/output.css
+
+```javascript
+_{{dist/output.css}}_
+```
+
+## production
+
+```javascript
+_{{production:dist/output.css}}_
+```
+
+# dist/1.output.css
+
+```javascript
+_{{dist/1.output.css}}_
+```
+
+# Info
+
+## Unoptimized
+
+```
+_{{stdout}}_
+```
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/css/webpack.config.js b/examples/css/webpack.config.js
new file mode 100644
index 00000000000..93ef7f910e6
--- /dev/null
+++ b/examples/css/webpack.config.js
@@ -0,0 +1,8 @@
+module.exports = {
+ output: {
+ uniqueName: "app"
+ },
+ experiments: {
+ css: true
+ }
+};
diff --git a/examples/custom-json-modules/README.md b/examples/custom-json-modules/README.md
index 113cb382c53..95a5e0e6b33 100644
--- a/examples/custom-json-modules/README.md
+++ b/examples/custom-json-modules/README.md
@@ -101,33 +101,7 @@ module.exports = {
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
-/* 0 */
-/*!********************!*\
- !*** ./example.js ***!
- \********************/
-/*! namespace exports */
-/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _data_toml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./data.toml */ 1);
-/* harmony import */ var _data_yaml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./data.yaml */ 2);
-/* harmony import */ var _data_json5__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./data.json5 */ 3);
-
-
-
-
-document.querySelector('#app').innerHTML = [_data_toml__WEBPACK_IMPORTED_MODULE_0__, _data_yaml__WEBPACK_IMPORTED_MODULE_1__, _data_json5__WEBPACK_IMPORTED_MODULE_2__].map(data => `
- ${data.title}
- ${data.owner.name}
- ${data.owner.organization}
- ${data.owner.bio}
- ${data.owner.dob}
-`).join(' ');
-
-
-/***/ }),
+/* 0 */,
/* 1 */
/*!*******************!*\
!*** ./data.toml ***!
@@ -145,7 +119,7 @@ document.querySelector('#app').innerHTML = [_data_toml__WEBPACK_IMPORTED_MODULE_
/*! runtime requirements: module */
/***/ ((module) => {
-module.exports = JSON.parse("{\"title\":\"TOML Example\",\"owner\":{\"name\":\"Tom Preston-Werner\",\"organization\":\"GitHub\",\"bio\":\"GitHub Cofounder & CEO\\nLikes tater tots and beer.\",\"dob\":\"1979-05-27T07:32:00.000Z\"}}");
+module.exports = JSON.parse('{"title":"TOML Example","owner":{"name":"Tom Preston-Werner","organization":"GitHub","bio":"GitHub Cofounder & CEO\\nLikes tater tots and beer.","dob":"1979-05-27T07:32:00.000Z"}}');
/***/ }),
/* 2 */
@@ -165,7 +139,7 @@ module.exports = JSON.parse("{\"title\":\"TOML Example\",\"owner\":{\"name\":\"T
/*! runtime requirements: module */
/***/ ((module) => {
-module.exports = JSON.parse("{\"title\":\"YAML Example\",\"owner\":{\"name\":\"Tom Preston-Werner\",\"organization\":\"GitHub\",\"bio\":\"GitHub Cofounder & CEO\\nLikes tater tots and beer.\",\"dob\":\"1979-05-27T07:32:00.000Z\"}}");
+module.exports = JSON.parse('{"title":"YAML Example","owner":{"name":"Tom Preston-Werner","organization":"GitHub","bio":"GitHub Cofounder & CEO\\nLikes tater tots and beer.","dob":"1979-05-27T07:32:00.000Z"}}');
/***/ }),
/* 3 */
@@ -184,7 +158,7 @@ module.exports = JSON.parse("{\"title\":\"YAML Example\",\"owner\":{\"name\":\"T
/*! runtime requirements: module */
/***/ ((module) => {
-module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\"Tom Preston-Werner\",\"organization\":\"GitHub\",\"bio\":\"GitHub Cofounder & CEO\\nLikes tater tots and beer.\",\"dob\":\"1979-05-27T07:32:00.000Z\"}}");
+module.exports = JSON.parse('{"title":"JSON5 Example","owner":{"name":"Tom Preston-Werner","organization":"GitHub","bio":"GitHub Cofounder & CEO\\nLikes tater tots and beer.","dob":"1979-05-27T07:32:00.000Z"}}');
/***/ })
/******/ ]);
@@ -200,8 +174,9 @@ module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\"
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -235,10 +210,33 @@ module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\"
``` js
-/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
-/******/ // This entry module used 'exports' so it can't be inlined
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+(() => {
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _data_toml__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./data.toml */ 1);
+/* harmony import */ var _data_yaml__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./data.yaml */ 2);
+/* harmony import */ var _data_json5__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./data.json5 */ 3);
+
+
+
+
+document.querySelector('#app').innerHTML = [_data_toml__WEBPACK_IMPORTED_MODULE_0__, _data_yaml__WEBPACK_IMPORTED_MODULE_1__, _data_json5__WEBPACK_IMPORTED_MODULE_2__].map(data => `
+ ${data.title}
+ ${data.owner.name}
+ ${data.owner.organization}
+ ${data.owner.bio}
+ ${data.owner.dob}
+`).join(' ');
+
+})();
+
/******/ })()
;
```
@@ -248,7 +246,7 @@ module.exports = JSON.parse("{\"title\":\"JSON5 Example\",\"owner\":{\"name\":\"
## webpack output
```
-asset output.js 5.98 KiB [emitted] (name: main)
+asset output.js 5.87 KiB [emitted] (name: main)
chunk (runtime: main) output.js (main) 919 bytes (javascript) 274 bytes (runtime) [entry] [rendered]
> ./example.js main
dependent modules 565 bytes [dependent] 3 modules
@@ -257,5 +255,5 @@ chunk (runtime: main) output.js (main) 919 bytes (javascript) 274 bytes (runtime
[no exports]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/dll-app-and-vendor/0-vendor/README.md b/examples/dll-app-and-vendor/0-vendor/README.md
index 1e2b1100f7e..58dff010f6e 100644
--- a/examples/dll-app-and-vendor/0-vendor/README.md
+++ b/examples/dll-app-and-vendor/0-vendor/README.md
@@ -13,7 +13,7 @@ var path = require("path");
var webpack = require("../../../");
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
context: __dirname,
entry: ["example-vendor"],
output: {
@@ -41,7 +41,7 @@ export function square(n) {
# dist/vendor.js
```javascript
-var vendor_lib_d696c7b4f72a4a70f39b;vendor_lib_d696c7b4f72a4a70f39b =
+var vendor_lib_bef1463383efb1c65306;
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ([
/* 0 */
@@ -68,7 +68,7 @@ module.exports = __webpack_require__;
"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "square": () => /* binding */ square
+/* harmony export */ "square": () => (/* binding */ square)
/* harmony export */ });
function square(n) {
return n * n;
@@ -89,8 +89,9 @@ function square(n) {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -121,7 +122,7 @@ function square(n) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
@@ -141,10 +142,13 @@ function square(n) {
``` js
-/******/ // module exports must be returned from runtime so entry inlining is disabled
+/******/
/******/ // startup
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
+/******/ // This entry module doesn't tell about it's top-level declarations so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/ vendor_lib_bef1463383efb1c65306 = __webpack_exports__;
+/******/
/******/ })()
;
```
@@ -152,7 +156,7 @@ function square(n) {
# dist/vendor-manifest.json
```javascript
-{"name":"vendor_lib_d696c7b4f72a4a70f39b","content":{"../node_modules/example-vendor.js":{"id":1,"buildMeta":{"exportsType":"namespace"},"exports":["square"]}}}
+{"name":"vendor_lib_bef1463383efb1c65306","content":{"../node_modules/example-vendor.js":{"id":1,"buildMeta":{"exportsType":"namespace"},"exports":["square"]}}}
```
# Info
@@ -160,28 +164,28 @@ function square(n) {
## Unoptimized
```
-asset vendor.js 3.56 KiB [emitted] (name: main)
-chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 668 bytes (runtime) [entry] [rendered]
+asset vendor.js 3.68 KiB [emitted] (name: main)
+chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 670 bytes (runtime) [entry] [rendered]
> main
- runtime modules 668 bytes 3 modules
+ runtime modules 670 bytes 3 modules
dependent modules 45 bytes [dependent] 1 module
dll main 12 bytes [built] [code generated]
[used exports unknown]
dll entry
used as library export
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset vendor.js 638 bytes [emitted] [minimized] (name: main)
-chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 668 bytes (runtime) [entry] [rendered]
+asset vendor.js 653 bytes [emitted] [minimized] (name: main)
+chunk (runtime: main) vendor.js (main) 57 bytes (javascript) 670 bytes (runtime) [entry] [rendered]
> main
- runtime modules 668 bytes 3 modules
+ runtime modules 670 bytes 3 modules
dependent modules 45 bytes [dependent] 1 module
dll main 12 bytes [built] [code generated]
dll entry
used as library export
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/dll-app-and-vendor/0-vendor/webpack.config.js b/examples/dll-app-and-vendor/0-vendor/webpack.config.js
index 3572be39ce8..5a9099cdb5c 100644
--- a/examples/dll-app-and-vendor/0-vendor/webpack.config.js
+++ b/examples/dll-app-and-vendor/0-vendor/webpack.config.js
@@ -2,7 +2,7 @@ var path = require("path");
var webpack = require("../../../");
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
context: __dirname,
entry: ["example-vendor"],
output: {
diff --git a/examples/dll-app-and-vendor/1-app/README.md b/examples/dll-app-and-vendor/1-app/README.md
index 83238a34185..2bc772a62dc 100644
--- a/examples/dll-app-and-vendor/1-app/README.md
+++ b/examples/dll-app-and-vendor/1-app/README.md
@@ -50,28 +50,10 @@ console.log(new square(7));
```javascript
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ([
-/* 0 */
-/*!************************!*\
- !*** ./example-app.js ***!
- \************************/
-/*! namespace exports */
-/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-"use strict";
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var example_vendor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! example-vendor */ 1);
-
-
-console.log((0,example_vendor__WEBPACK_IMPORTED_MODULE_0__.square)(7));
-console.log(new example_vendor__WEBPACK_IMPORTED_MODULE_0__.square(7));
-
-
-/***/ }),
+/* 0 */,
/* 1 */
/*!******************************************************************************************************!*\
- !*** delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_d696c7b4f72a4a70f39b ***!
+ !*** delegated ../node_modules/example-vendor.js from dll-reference vendor_lib_bef1463383efb1c65306 ***!
\******************************************************************************************************/
/*! namespace exports */
/*! export square [provided] [no usage info] [provision prevents renaming (no use info)] */
@@ -79,12 +61,12 @@ console.log(new example_vendor__WEBPACK_IMPORTED_MODULE_0__.square(7));
/*! runtime requirements: module, __webpack_require__ */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
-module.exports = (__webpack_require__(/*! dll-reference vendor_lib_d696c7b4f72a4a70f39b */ 2))(1);
+module.exports = (__webpack_require__(/*! dll-reference vendor_lib_bef1463383efb1c65306 */ 2))(1);
/***/ }),
/* 2 */
/*!**************************************************!*\
- !*** external "vendor_lib_d696c7b4f72a4a70f39b" ***!
+ !*** external "vendor_lib_bef1463383efb1c65306" ***!
\**************************************************/
/*! dynamic exports */
/*! exports [maybe provided (runtime-defined)] [no usage info] */
@@ -92,7 +74,7 @@ module.exports = (__webpack_require__(/*! dll-reference vendor_lib_d696c7b4f72a4
/***/ ((module) => {
"use strict";
-module.exports = vendor_lib_d696c7b4f72a4a70f39b;
+module.exports = vendor_lib_bef1463383efb1c65306;
/***/ })
/******/ ]);
@@ -108,8 +90,9 @@ module.exports = vendor_lib_d696c7b4f72a4a70f39b;
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -143,10 +126,25 @@ module.exports = vendor_lib_d696c7b4f72a4a70f39b;
``` js
-/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
-/******/ // This entry module used 'exports' so it can't be inlined
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be in strict mode.
+(() => {
+"use strict";
+/*!************************!*\
+ !*** ./example-app.js ***!
+ \************************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var example_vendor__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! example-vendor */ 1);
+
+
+console.log((0,example_vendor__WEBPACK_IMPORTED_MODULE_0__.square)(7));
+console.log(new example_vendor__WEBPACK_IMPORTED_MODULE_0__.square(7));
+
+})();
+
/******/ })()
;
```
@@ -156,7 +154,7 @@ module.exports = vendor_lib_d696c7b4f72a4a70f39b;
## Unoptimized
```
-asset app.js 3.52 KiB [emitted] (name: main)
+asset app.js 3.44 KiB [emitted] (name: main)
chunk (runtime: main) app.js (main) 178 bytes (javascript) 274 bytes (runtime) [entry] [rendered]
> ./example-app main
dependent modules 84 bytes [dependent] 2 modules
@@ -165,13 +163,13 @@ chunk (runtime: main) app.js (main) 178 bytes (javascript) 274 bytes (runtime) [
[no exports]
[used exports unknown]
entry ./example-app main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset app.js 319 bytes [emitted] [minimized] (name: main)
+asset app.js 333 bytes [emitted] [minimized] (name: main)
chunk (runtime: main) app.js (main) 178 bytes [entry] [rendered]
> ./example-app main
dependent modules 84 bytes [dependent] 2 modules
@@ -179,7 +177,7 @@ chunk (runtime: main) app.js (main) 178 bytes [entry] [rendered]
[no exports]
[no exports used]
entry ./example-app main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
-
+
@@ -335,57 +335,81 @@ export default Component;
/******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ({
-/***/ 12:
+/***/ 0:
+/*!**********************!*\
+ !*** ./src/index.js ***!
+ \**********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: __webpack_require__.e, __webpack_require__, __webpack_require__.* */
+/***/ ((__unused_webpack_module, __unused_webpack_exports, __webpack_require__) => {
+
+// Sharing modules requires that all remotes are initialized
+// and can provide shared modules to the common scope
+// As this is an async operation we need an async boundary (import())
+
+// Using modules from remotes is also an async operation
+// as chunks need to be loaded for the code of the remote module
+// This also requires an async boundary (import())
+
+// At this point shared modules initialized and remote modules are loaded
+Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js"), __webpack_require__.e("src_bootstrap_js")]).then(__webpack_require__.bind(__webpack_require__, /*! ./bootstrap */ 2));
+
+// It's possible to place more code here to do stuff on page init
+// but it can't use any of the shared modules or remote modules.
+
+/***/ }),
+
+/***/ 10:
/*!*********************************************!*\
!*** external "mfeBBB@/dist/bbb/mfeBBB.js" ***!
\*********************************************/
/*! dynamic exports */
/*! exports [maybe provided (runtime-defined)] [no usage info] */
-/*! runtime requirements: module, __webpack_require__.l, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__.l, module, __webpack_require__.* */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
-var error = new Error();
+var __webpack_error__ = new Error();
module.exports = new Promise((resolve, reject) => {
if(typeof mfeBBB !== "undefined") return resolve();
__webpack_require__.l("/dist/bbb/mfeBBB.js", (event) => {
if(typeof mfeBBB !== "undefined") return resolve();
var errorType = event && (event.type === 'load' ? 'missing' : event.type);
var realSrc = event && event.target && event.target.src;
- error.message = 'Loading script failed.\n(' + errorType + ': ' + realSrc + ')';
- error.name = 'ScriptExternalLoadError';
- error.type = errorType;
- error.request = realSrc;
- reject(error);
+ __webpack_error__.message = 'Loading script failed.\n(' + errorType + ': ' + realSrc + ')';
+ __webpack_error__.name = 'ScriptExternalLoadError';
+ __webpack_error__.type = errorType;
+ __webpack_error__.request = realSrc;
+ reject(__webpack_error__);
}, "mfeBBB");
-}).then(() => mfeBBB);
+}).then(() => (mfeBBB));
/***/ }),
-/***/ 14:
+/***/ 12:
/*!*********************************************!*\
!*** external "mfeCCC@/dist/ccc/mfeCCC.js" ***!
\*********************************************/
/*! dynamic exports */
/*! exports [maybe provided (runtime-defined)] [no usage info] */
-/*! runtime requirements: module, __webpack_require__.l, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__.l, module, __webpack_require__.* */
/***/ ((module, __unused_webpack_exports, __webpack_require__) => {
"use strict";
-var error = new Error();
+var __webpack_error__ = new Error();
module.exports = new Promise((resolve, reject) => {
if(typeof mfeCCC !== "undefined") return resolve();
__webpack_require__.l("/dist/ccc/mfeCCC.js", (event) => {
if(typeof mfeCCC !== "undefined") return resolve();
var errorType = event && (event.type === 'load' ? 'missing' : event.type);
var realSrc = event && event.target && event.target.src;
- error.message = 'Loading script failed.\n(' + errorType + ': ' + realSrc + ')';
- error.name = 'ScriptExternalLoadError';
- error.type = errorType;
- error.request = realSrc;
- reject(error);
+ __webpack_error__.message = 'Loading script failed.\n(' + errorType + ': ' + realSrc + ')';
+ __webpack_error__.name = 'ScriptExternalLoadError';
+ __webpack_error__.type = errorType;
+ __webpack_error__.request = realSrc;
+ reject(__webpack_error__);
}, "mfeCCC");
-}).then(() => mfeCCC);
+}).then(() => (mfeCCC));
/***/ })
@@ -402,8 +426,9 @@ module.exports = new Promise((resolve, reject) => {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -422,14 +447,17 @@ module.exports = new Promise((resolve, reject) => {
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = __webpack_module_cache__;
+/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
-/******/ () => module['default'] :
-/******/ () => module;
+/******/ () => (module['default']) :
+/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
@@ -437,7 +465,7 @@ module.exports = new Promise((resolve, reject) => {
/******/
/******/ /* webpack/runtime/create fake namespace object */
/******/ (() => {
-/******/ var getProto = Object.getPrototypeOf ? (obj) => Object.getPrototypeOf(obj) : (obj) => obj.__proto__;
+/******/ var getProto = Object.getPrototypeOf ? (obj) => (Object.getPrototypeOf(obj)) : (obj) => (obj.__proto__);
/******/ var leafPrototypes;
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
@@ -457,9 +485,9 @@ module.exports = new Promise((resolve, reject) => {
/******/ var def = {};
/******/ leafPrototypes = leafPrototypes || [null, getProto({}), getProto([]), getProto(getProto)];
/******/ for(var current = mode & 2 && value; typeof current == 'object' && !~leafPrototypes.indexOf(current); current = getProto(current)) {
-/******/ Object.getOwnPropertyNames(current).forEach(key => def[key] = () => value[key]);
+/******/ Object.getOwnPropertyNames(current).forEach((key) => (def[key] = () => (value[key])));
/******/ }
-/******/ def['default'] = () => value;
+/******/ def['default'] = () => (value);
/******/ __webpack_require__.d(ns, def);
/******/ return ns;
/******/ };
@@ -501,7 +529,7 @@ module.exports = new Promise((resolve, reject) => {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -509,7 +537,7 @@ module.exports = new Promise((resolve, reject) => {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "module-federation-aaa:";
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -539,10 +567,9 @@ module.exports = new Promise((resolve, reject) => {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -564,29 +591,29 @@ module.exports = new Promise((resolve, reject) => {
/******/ /* webpack/runtime/remotes loading */
/******/ (() => {
/******/ var chunkMapping = {
-/******/ "src_bootstrap_js-webpack_sharing_consume_default_react_react": [
-/******/ 11,
-/******/ 13
+/******/ "src_bootstrap_js": [
+/******/ 9,
+/******/ 11
/******/ ],
/******/ "webpack_container_remote_mfe-c_Component2": [
-/******/ 27
+/******/ 25
/******/ ]
/******/ };
/******/ var idToExternalAndNameMapping = {
-/******/ "11": [
+/******/ "9": [
/******/ "default",
/******/ "./Component",
-/******/ 12
+/******/ 10
/******/ ],
-/******/ "13": [
+/******/ "11": [
/******/ "default",
/******/ "./Component",
-/******/ 14
+/******/ 12
/******/ ],
-/******/ "27": [
+/******/ "25": [
/******/ "default",
/******/ "./Component2",
-/******/ 14
+/******/ 12
/******/ ]
/******/ };
/******/ __webpack_require__.f.remotes = (chunkId, promises) => {
@@ -602,7 +629,7 @@ module.exports = new Promise((resolve, reject) => {
/******/ if(!error) error = new Error("Container missing");
/******/ if(typeof error.message === "string")
/******/ error.message += '\nwhile loading "' + data[1] + '" from ' + data[2];
-/******/ __webpack_modules__[id] = () => {
+/******/ __webpack_require__.m[id] = () => {
/******/ throw error;
/******/ }
/******/ data.p = 0;
@@ -611,7 +638,7 @@ module.exports = new Promise((resolve, reject) => {
/******/ try {
/******/ var promise = fn(arg1, arg2);
/******/ if(promise && promise.then) {
-/******/ var p = promise.then((result) => next(result, d), onError);
+/******/ var p = promise.then((result) => (next(result, d)), onError);
/******/ if(first) promises.push(data.p = p); else return p;
/******/ } else {
/******/ return next(promise, d, first);
@@ -620,11 +647,11 @@ module.exports = new Promise((resolve, reject) => {
/******/ onError(error);
/******/ }
/******/ }
-/******/ var onExternal = (external, _, first) => external ? handleFunction(__webpack_require__.I, data[0], 0, external, onInitialized, first) : onError();
-/******/ var onInitialized = (_, external, first) => handleFunction(external.get, data[1], getScope, 0, onFactory, first);
+/******/ var onExternal = (external, _, first) => (external ? handleFunction(__webpack_require__.I, data[0], 0, external, onInitialized, first) : onError());
+/******/ var onInitialized = (_, external, first) => (handleFunction(external.get, data[1], getScope, 0, onFactory, first));
/******/ var onFactory = (factory) => {
/******/ data.p = 1;
-/******/ __webpack_modules__[id] = (module) => {
+/******/ __webpack_require__.m[id] = (module) => {
/******/ module.exports = factory();
/******/ }
/******/ };
@@ -652,35 +679,39 @@ module.exports = new Promise((resolve, reject) => {
/******/ if(!__webpack_require__.o(__webpack_require__.S, name)) __webpack_require__.S[name] = {};
/******/ // runs all init snippets from all modules reachable
/******/ var scope = __webpack_require__.S[name];
-/******/ var warn = (msg) => typeof console !== "undefined" && console.warn && console.warn(msg);;
+/******/ var warn = (msg) => {
+/******/ typeof console !== "undefined" && console.warn ? console.warn(msg) : (() => {
+/******/
+/******/ })()
+/******/ };
/******/ var uniqueName = "module-federation-aaa";
-/******/ var register = (name, version, factory) => {
+/******/ var register = (name, version, factory, eager) => {
/******/ var versions = scope[name] = scope[name] || {};
/******/ var activeVersion = versions[version];
-/******/ if(!activeVersion || !activeVersion.loaded && uniqueName > activeVersion.from) versions[version] = { get: factory, from: uniqueName };
+/******/ if(!activeVersion || (!activeVersion.loaded && (!eager != !activeVersion.eager ? eager : uniqueName > activeVersion.from))) versions[version] = { get: factory, from: uniqueName, eager: !!eager };
/******/ };
/******/ var initExternal = (id) => {
-/******/ var handleError = (err) => warn("Initialization of sharing external failed: " + err);
+/******/ var handleError = (err) => (warn("Initialization of sharing external failed: " + err));
/******/ try {
/******/ var module = __webpack_require__(id);
/******/ if(!module) return;
-/******/ var initFn = (module) => module && module.init && module.init(__webpack_require__.S[name], initScope)
+/******/ var initFn = (module) => (module && module.init && module.init(__webpack_require__.S[name], initScope))
/******/ if(module.then) return promises.push(module.then(initFn, handleError));
/******/ var initResult = initFn(module);
-/******/ if(initResult && initResult.then) return promises.push(initResult.catch(handleError));
+/******/ if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));
/******/ } catch(err) { handleError(err); }
/******/ }
/******/ var promises = [];
/******/ switch(name) {
/******/ case "default": {
-/******/ register("react", "17.0.1", () => __webpack_require__.e("node_modules_react_index_js-_11190").then(() => () => __webpack_require__(/*! ../../node_modules/react/index.js */ 25)));
+/******/ register("react", "18.2.0", () => (__webpack_require__.e("node_modules_react_index_js").then(() => (() => (__webpack_require__(/*! ../../node_modules/react/index.js */ 23))))));
+/******/ initExternal(10);
/******/ initExternal(12);
-/******/ initExternal(14);
/******/ }
/******/ break;
/******/ }
/******/ if(!promises.length) return initPromises[name] = 1;
-/******/ return initPromises[name] = Promise.all(promises).then(() => initPromises[name] = 1);
+/******/ return initPromises[name] = Promise.all(promises).then(() => (initPromises[name] = 1));
/******/ };
/******/ })();
/******/
@@ -701,7 +732,7 @@ module.exports = new Promise((resolve, reject) => {
/******/ }
/******/ var rangeToString = (range) => {
/******/ // see webpack/lib/util/semver.js for original code
-/******/ if(1===range.length)return"*";if(0 in range){var r="",n=range[0];r+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return r}var g=[];for(a=1;a=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a {
/******/ // see webpack/lib/util/semver.js for original code
@@ -725,17 +756,21 @@ module.exports = new Promise((resolve, reject) => {
/******/ return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;
/******/ }, 0);
/******/ };
-/******/ var getInvalidSingletonVersionMessage = (key, version, requiredVersion) => {
-/******/ return "Unsatisfied version " + version + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"
+/******/ var getInvalidSingletonVersionMessage = (scope, key, version, requiredVersion) => {
+/******/ return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"
+/******/ };
+/******/ var getSingleton = (scope, scopeName, key, requiredVersion) => {
+/******/ var version = findSingletonVersionKey(scope, key);
+/******/ return get(scope[key][version]);
/******/ };
/******/ var getSingletonVersion = (scope, scopeName, key, requiredVersion) => {
/******/ var version = findSingletonVersionKey(scope, key);
-/******/ if (!satisfy(requiredVersion, version)) typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(key, version, requiredVersion));
+/******/ if (!satisfy(requiredVersion, version)) typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));
/******/ return get(scope[key][version]);
/******/ };
/******/ var getStrictSingletonVersion = (scope, scopeName, key, requiredVersion) => {
/******/ var version = findSingletonVersionKey(scope, key);
-/******/ if (!satisfy(requiredVersion, version)) throw new Error(getInvalidSingletonVersionMessage(key, version, requiredVersion));
+/******/ if (!satisfy(requiredVersion, version)) throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));
/******/ return get(scope[key][version]);
/******/ };
/******/ var findValidVersion = (scope, key, requiredVersion) => {
@@ -758,18 +793,23 @@ module.exports = new Promise((resolve, reject) => {
/******/ if(entry) return get(entry);
/******/ throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
/******/ };
+/******/ var warn = (msg) => {
+/******/ typeof console !== "undefined" && console.warn ? console.warn(msg) : (() => {
+/******/
+/******/ })()
+/******/ };
/******/ var warnInvalidVersion = (scope, scopeName, key, requiredVersion) => {
-/******/ typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
+/******/ warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
/******/ };
/******/ var get = (entry) => {
/******/ entry.loaded = 1;
/******/ return entry.get()
/******/ };
-/******/ var init = (fn) => function(scopeName, a, b, c) {
+/******/ var init = (fn) => (function(scopeName, a, b, c) {
/******/ var promise = __webpack_require__.I(scopeName);
/******/ if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, __webpack_require__.S[scopeName], a, b, c));
/******/ return fn(scopeName, __webpack_require__.S[scopeName], a, b, c);
-/******/ };
+/******/ });
/******/
/******/ var load = /*#__PURE__*/ init((scopeName, scope, key) => {
/******/ ensureExistence(scopeName, key);
@@ -782,6 +822,10 @@ module.exports = new Promise((resolve, reject) => {
/******/ ensureExistence(scopeName, key);
/******/ return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));
/******/ });
+/******/ var loadSingleton = /*#__PURE__*/ init((scopeName, scope, key) => {
+/******/ ensureExistence(scopeName, key);
+/******/ return getSingleton(scope, scopeName, key);
+/******/ });
/******/ var loadSingletonVersionCheck = /*#__PURE__*/ init((scopeName, scope, key, version) => {
/******/ ensureExistence(scopeName, key);
/******/ return getSingletonVersion(scope, scopeName, key, version);
@@ -798,6 +842,10 @@ module.exports = new Promise((resolve, reject) => {
/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
/******/ return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));
/******/ });
+/******/ var loadSingletonFallback = /*#__PURE__*/ init((scopeName, scope, key, fallback) => {
+/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
+/******/ return getSingleton(scope, scopeName, key);
+/******/ });
/******/ var loadSingletonVersionCheckFallback = /*#__PURE__*/ init((scopeName, scope, key, version, fallback) => {
/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
/******/ return getSingletonVersion(scope, scopeName, key, version);
@@ -812,14 +860,12 @@ module.exports = new Promise((resolve, reject) => {
/******/ });
/******/ var installedModules = {};
/******/ var moduleToHandlerMapping = {
-/******/ 5: () => loadSingletonVersionCheckFallback("default", "react", [4,17,0,1], () => __webpack_require__.e("node_modules_react_index_js-_11191").then(() => () => __webpack_require__(/*! react */ 25))),
-/******/ 9: () => loadSingletonVersionCheckFallback("default", "react", [1,17,0,1], () => __webpack_require__.e("node_modules_react_index_js-_11191").then(() => () => __webpack_require__(/*! react */ 25)))
+/******/ 5: () => (loadSingletonVersionCheckFallback("default", "react", [1,18,2,0], () => (__webpack_require__.e("node_modules_react_index_js").then(() => (() => (__webpack_require__(/*! react */ 23)))))))
/******/ };
/******/ // no consumes in initial chunks
/******/ var chunkMapping = {
-/******/ "src_bootstrap_js-webpack_sharing_consume_default_react_react": [
-/******/ 5,
-/******/ 9
+/******/ "src_bootstrap_js": [
+/******/ 5
/******/ ]
/******/ };
/******/ __webpack_require__.f.consumes = (chunkId, promises) => {
@@ -828,22 +874,22 @@ module.exports = new Promise((resolve, reject) => {
/******/ if(__webpack_require__.o(installedModules, id)) return promises.push(installedModules[id]);
/******/ var onFactory = (factory) => {
/******/ installedModules[id] = 0;
-/******/ __webpack_modules__[id] = (module) => {
-/******/ delete __webpack_module_cache__[id];
+/******/ __webpack_require__.m[id] = (module) => {
+/******/ delete __webpack_require__.c[id];
/******/ module.exports = factory();
/******/ }
/******/ };
/******/ var onError = (error) => {
/******/ delete installedModules[id];
-/******/ __webpack_modules__[id] = (module) => {
-/******/ delete __webpack_module_cache__[id];
+/******/ __webpack_require__.m[id] = (module) => {
+/******/ delete __webpack_require__.c[id];
/******/ throw error;
/******/ }
/******/ };
/******/ try {
/******/ var promise = moduleToHandlerMapping[id]();
/******/ if(promise.then) {
-/******/ promises.push(installedModules[id] = promise.then(onFactory).catch(onError));
+/******/ promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));
/******/ } else onFactory(promise);
/******/ } catch(e) { onError(e); }
/******/ });
@@ -857,12 +903,11 @@ module.exports = new Promise((resolve, reject) => {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "app": 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -874,9 +919,7 @@ module.exports = new Promise((resolve, reject) => {
/******/ } else {
/******/ if("webpack_container_remote_mfe-c_Component2" != chunkId) {
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -898,7 +941,7 @@ module.exports = new Promise((resolve, reject) => {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -912,39 +955,36 @@ module.exports = new Promise((resolve, reject) => {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunkmodule_federation_aaa"] = self["webpackChunkmodule_federation_aaa"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -953,23 +993,12 @@ module.exports = new Promise((resolve, reject) => {
``` js
-(() => {
-/*!**********************!*\
- !*** ./src/index.js ***!
- \**********************/
-/*! unknown exports (runtime-defined) */
-/*! runtime requirements: __webpack_require__.e, __webpack_require__, __webpack_require__.* */
-// Sharing modules requires that all remotes are initialized
-// and can provide shared modules to the common scope
-// As this is an async operation we need an async boundary (import())
-// Using modules from remotes is also an async operation
-// as chunks need to be loaded for the code of the remote module
-// This also requires an async boundary (import())
-// At this point shared modules initialized and remote modules are loaded
-Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js"), __webpack_require__.e("src_bootstrap_js-webpack_sharing_consume_default_react_react")]).then(__webpack_require__.bind(__webpack_require__, /*! ./bootstrap */ 2)); // It's possible to place more code here to do stuff on page init
-// but it can't use any of the shared modules or remote modules.
-})();
-
+/******/
+/******/ // module cache are used so entry inlining is disabled
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/
/******/ })()
;
```
@@ -977,7 +1006,7 @@ Promise.all(/*! import() */[__webpack_require__.e("vendors-node_modules_date-fns
# dist/bbb/mfeBBB.js
```javascript
-var mfeBBB;mfeBBB =
+var mfeBBB;
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
@@ -985,13 +1014,16 @@ var mfeBBB;mfeBBB =
/*!***********************!*\
!*** container entry ***!
\***********************/
-/*! unknown exports (runtime-defined) */
+/*! namespace exports */
+/*! export get [provided] [maybe used in mfeBBB (runtime-defined)] [usage and provision prevents renaming] */
+/*! export init [provided] [maybe used in mfeBBB (runtime-defined)] [usage and provision prevents renaming] */
+/*! other exports [not provided] [maybe used in mfeBBB (runtime-defined)] */
/*! runtime requirements: __webpack_require__.d, __webpack_require__.o, __webpack_exports__, __webpack_require__.e, __webpack_require__, __webpack_require__.* */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
var moduleMap = {
"./Component": () => {
- return __webpack_require__.e("src-b_Component_js").then(() => () => (__webpack_require__(/*! ./src-b/Component */ 3)));
+ return __webpack_require__.e("src-b_Component_js").then(() => (() => ((__webpack_require__(/*! ./src-b/Component */ 3)))));
}
};
var get = (module, getScope) => {
@@ -1008,8 +1040,8 @@ var get = (module, getScope) => {
};
var init = (shareScope, initScope) => {
if (!__webpack_require__.S) return;
- var oldScope = __webpack_require__.S["default"];
var name = "default"
+ var oldScope = __webpack_require__.S[name];
if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");
__webpack_require__.S[name] = shareScope;
return __webpack_require__.I(name, initScope);
@@ -1017,8 +1049,8 @@ var init = (shareScope, initScope) => {
// This exports getters to disallow modifications
__webpack_require__.d(exports, {
- get: () => get,
- init: () => init
+ get: () => (get),
+ init: () => (init)
});
/***/ })
@@ -1035,8 +1067,9 @@ __webpack_require__.d(exports, {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -1055,14 +1088,17 @@ __webpack_require__.d(exports, {
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = __webpack_module_cache__;
+/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
-/******/ () => module['default'] :
-/******/ () => module;
+/******/ () => (module['default']) :
+/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
@@ -1104,7 +1140,7 @@ __webpack_require__.d(exports, {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -1112,7 +1148,7 @@ __webpack_require__.d(exports, {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "module-federation-bbb:";
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -1142,10 +1178,9 @@ __webpack_require__.d(exports, {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -1182,34 +1217,38 @@ __webpack_require__.d(exports, {
/******/ if(!__webpack_require__.o(__webpack_require__.S, name)) __webpack_require__.S[name] = {};
/******/ // runs all init snippets from all modules reachable
/******/ var scope = __webpack_require__.S[name];
-/******/ var warn = (msg) => typeof console !== "undefined" && console.warn && console.warn(msg);;
+/******/ var warn = (msg) => {
+/******/ typeof console !== "undefined" && console.warn ? console.warn(msg) : (() => {
+/******/
+/******/ })()
+/******/ };
/******/ var uniqueName = "module-federation-bbb";
-/******/ var register = (name, version, factory) => {
+/******/ var register = (name, version, factory, eager) => {
/******/ var versions = scope[name] = scope[name] || {};
/******/ var activeVersion = versions[version];
-/******/ if(!activeVersion || !activeVersion.loaded && uniqueName > activeVersion.from) versions[version] = { get: factory, from: uniqueName };
+/******/ if(!activeVersion || (!activeVersion.loaded && (!eager != !activeVersion.eager ? eager : uniqueName > activeVersion.from))) versions[version] = { get: factory, from: uniqueName, eager: !!eager };
/******/ };
/******/ var initExternal = (id) => {
-/******/ var handleError = (err) => warn("Initialization of sharing external failed: " + err);
+/******/ var handleError = (err) => (warn("Initialization of sharing external failed: " + err));
/******/ try {
/******/ var module = __webpack_require__(id);
/******/ if(!module) return;
-/******/ var initFn = (module) => module && module.init && module.init(__webpack_require__.S[name], initScope)
+/******/ var initFn = (module) => (module && module.init && module.init(__webpack_require__.S[name], initScope))
/******/ if(module.then) return promises.push(module.then(initFn, handleError));
/******/ var initResult = initFn(module);
-/******/ if(initResult && initResult.then) return promises.push(initResult.catch(handleError));
+/******/ if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));
/******/ } catch(err) { handleError(err); }
/******/ }
/******/ var promises = [];
/******/ switch(name) {
/******/ case "default": {
-/******/ register("date-fns", "2.16.1", () => __webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => () => __webpack_require__(/*! ../../node_modules/date-fns/esm/index.js */ 6)));
-/******/ register("react", "17.0.1", () => __webpack_require__.e("node_modules_react_index_js").then(() => () => __webpack_require__(/*! ../../node_modules/react/index.js */ 238)));
+/******/ register("date-fns", "2.29.3", () => (__webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => (() => (__webpack_require__(/*! ../../node_modules/date-fns/esm/index.js */ 6))))));
+/******/ register("react", "18.2.0", () => (__webpack_require__.e("node_modules_react_index_js").then(() => (() => (__webpack_require__(/*! ../../node_modules/react/index.js */ 319))))));
/******/ }
/******/ break;
/******/ }
/******/ if(!promises.length) return initPromises[name] = 1;
-/******/ return initPromises[name] = Promise.all(promises).then(() => initPromises[name] = 1);
+/******/ return initPromises[name] = Promise.all(promises).then(() => (initPromises[name] = 1));
/******/ };
/******/ })();
/******/
@@ -1230,7 +1269,7 @@ __webpack_require__.d(exports, {
/******/ }
/******/ var rangeToString = (range) => {
/******/ // see webpack/lib/util/semver.js for original code
-/******/ if(1===range.length)return"*";if(0 in range){var r="",n=range[0];r+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return r}var g=[];for(a=1;a=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a {
/******/ // see webpack/lib/util/semver.js for original code
@@ -1254,17 +1293,21 @@ __webpack_require__.d(exports, {
/******/ return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;
/******/ }, 0);
/******/ };
-/******/ var getInvalidSingletonVersionMessage = (key, version, requiredVersion) => {
-/******/ return "Unsatisfied version " + version + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"
+/******/ var getInvalidSingletonVersionMessage = (scope, key, version, requiredVersion) => {
+/******/ return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"
+/******/ };
+/******/ var getSingleton = (scope, scopeName, key, requiredVersion) => {
+/******/ var version = findSingletonVersionKey(scope, key);
+/******/ return get(scope[key][version]);
/******/ };
/******/ var getSingletonVersion = (scope, scopeName, key, requiredVersion) => {
/******/ var version = findSingletonVersionKey(scope, key);
-/******/ if (!satisfy(requiredVersion, version)) typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(key, version, requiredVersion));
+/******/ if (!satisfy(requiredVersion, version)) warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));
/******/ return get(scope[key][version]);
/******/ };
/******/ var getStrictSingletonVersion = (scope, scopeName, key, requiredVersion) => {
/******/ var version = findSingletonVersionKey(scope, key);
-/******/ if (!satisfy(requiredVersion, version)) throw new Error(getInvalidSingletonVersionMessage(key, version, requiredVersion));
+/******/ if (!satisfy(requiredVersion, version)) throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));
/******/ return get(scope[key][version]);
/******/ };
/******/ var findValidVersion = (scope, key, requiredVersion) => {
@@ -1287,18 +1330,23 @@ __webpack_require__.d(exports, {
/******/ if(entry) return get(entry);
/******/ throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
/******/ };
+/******/ var warn = (msg) => {
+/******/ typeof console !== "undefined" && console.warn ? console.warn(msg) : (() => {
+/******/
+/******/ })()
+/******/ };
/******/ var warnInvalidVersion = (scope, scopeName, key, requiredVersion) => {
-/******/ typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
+/******/ warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
/******/ };
/******/ var get = (entry) => {
/******/ entry.loaded = 1;
/******/ return entry.get()
/******/ };
-/******/ var init = (fn) => function(scopeName, a, b, c) {
+/******/ var init = (fn) => (function(scopeName, a, b, c) {
/******/ var promise = __webpack_require__.I(scopeName);
/******/ if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, __webpack_require__.S[scopeName], a, b, c));
/******/ return fn(scopeName, __webpack_require__.S[scopeName], a, b, c);
-/******/ };
+/******/ });
/******/
/******/ var load = /*#__PURE__*/ init((scopeName, scope, key) => {
/******/ ensureExistence(scopeName, key);
@@ -1311,6 +1359,10 @@ __webpack_require__.d(exports, {
/******/ ensureExistence(scopeName, key);
/******/ return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));
/******/ });
+/******/ var loadSingleton = /*#__PURE__*/ init((scopeName, scope, key) => {
+/******/ ensureExistence(scopeName, key);
+/******/ return getSingleton(scope, scopeName, key);
+/******/ });
/******/ var loadSingletonVersionCheck = /*#__PURE__*/ init((scopeName, scope, key, version) => {
/******/ ensureExistence(scopeName, key);
/******/ return getSingletonVersion(scope, scopeName, key, version);
@@ -1327,6 +1379,10 @@ __webpack_require__.d(exports, {
/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
/******/ return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));
/******/ });
+/******/ var loadSingletonFallback = /*#__PURE__*/ init((scopeName, scope, key, fallback) => {
+/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
+/******/ return getSingleton(scope, scopeName, key);
+/******/ });
/******/ var loadSingletonVersionCheckFallback = /*#__PURE__*/ init((scopeName, scope, key, version, fallback) => {
/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
/******/ return getSingletonVersion(scope, scopeName, key, version);
@@ -1341,8 +1397,8 @@ __webpack_require__.d(exports, {
/******/ });
/******/ var installedModules = {};
/******/ var moduleToHandlerMapping = {
-/******/ 4: () => loadSingletonVersionCheckFallback("default", "react", [1,17,0,1], () => __webpack_require__.e("node_modules_react_index_js").then(() => () => __webpack_require__(/*! react */ 238))),
-/******/ 5: () => loadStrictVersionCheckFallback("default", "date-fns", [1,2,15,0], () => __webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => () => __webpack_require__(/*! date-fns */ 6)))
+/******/ 4: () => (loadSingletonVersionCheckFallback("default", "react", [1,18,2,0], () => (__webpack_require__.e("node_modules_react_index_js").then(() => (() => (__webpack_require__(/*! react */ 319))))))),
+/******/ 5: () => (loadStrictVersionCheckFallback("default", "date-fns", [1,2,15,0], () => (__webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => (() => (__webpack_require__(/*! date-fns */ 6)))))))
/******/ };
/******/ // no consumes in initial chunks
/******/ var chunkMapping = {
@@ -1357,22 +1413,22 @@ __webpack_require__.d(exports, {
/******/ if(__webpack_require__.o(installedModules, id)) return promises.push(installedModules[id]);
/******/ var onFactory = (factory) => {
/******/ installedModules[id] = 0;
-/******/ __webpack_modules__[id] = (module) => {
-/******/ delete __webpack_module_cache__[id];
+/******/ __webpack_require__.m[id] = (module) => {
+/******/ delete __webpack_require__.c[id];
/******/ module.exports = factory();
/******/ }
/******/ };
/******/ var onError = (error) => {
/******/ delete installedModules[id];
-/******/ __webpack_modules__[id] = (module) => {
-/******/ delete __webpack_module_cache__[id];
+/******/ __webpack_require__.m[id] = (module) => {
+/******/ delete __webpack_require__.c[id];
/******/ throw error;
/******/ }
/******/ };
/******/ try {
/******/ var promise = moduleToHandlerMapping[id]();
/******/ if(promise.then) {
-/******/ promises.push(installedModules[id] = promise.then(onFactory).catch(onError));
+/******/ promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));
/******/ } else onFactory(promise);
/******/ } catch(e) { onError(e); }
/******/ });
@@ -1386,12 +1442,11 @@ __webpack_require__.d(exports, {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "mfeBBB": 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -1403,9 +1458,7 @@ __webpack_require__.d(exports, {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -1427,7 +1480,7 @@ __webpack_require__.d(exports, {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -1441,39 +1494,36 @@ __webpack_require__.d(exports, {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunkmodule_federation_bbb"] = self["webpackChunkmodule_federation_bbb"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -1482,10 +1532,13 @@ __webpack_require__.d(exports, {
``` js
-/******/ // module exports must be returned from runtime so entry inlining is disabled
+/******/
+/******/ // module cache are used so entry inlining is disabled
/******/ // startup
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/ mfeBBB = __webpack_exports__;
+/******/
/******/ })()
;
```
@@ -1493,7 +1546,7 @@ __webpack_require__.d(exports, {
# dist/ccc/mfeCCC.js
```javascript
-var mfeCCC;mfeCCC =
+var mfeCCC;
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
@@ -1501,16 +1554,19 @@ var mfeCCC;mfeCCC =
/*!***********************!*\
!*** container entry ***!
\***********************/
-/*! unknown exports (runtime-defined) */
+/*! namespace exports */
+/*! export get [provided] [maybe used in mfeCCC (runtime-defined)] [usage and provision prevents renaming] */
+/*! export init [provided] [maybe used in mfeCCC (runtime-defined)] [usage and provision prevents renaming] */
+/*! other exports [not provided] [maybe used in mfeCCC (runtime-defined)] */
/*! runtime requirements: __webpack_require__.d, __webpack_require__.o, __webpack_exports__, __webpack_require__.e, __webpack_require__, __webpack_require__.* */
/***/ ((__unused_webpack_module, exports, __webpack_require__) => {
var moduleMap = {
"./Component": () => {
- return Promise.all([__webpack_require__.e("webpack_sharing_consume_default_react"), __webpack_require__.e("src-c_Component_js")]).then(() => () => (__webpack_require__(/*! ./src-c/Component */ 3)));
+ return Promise.all([__webpack_require__.e("webpack_sharing_consume_default_react"), __webpack_require__.e("src-c_Component_js")]).then(() => (() => ((__webpack_require__(/*! ./src-c/Component */ 3)))));
},
"./Component2": () => {
- return Promise.all([__webpack_require__.e("webpack_sharing_consume_default_react"), __webpack_require__.e("src-c_LazyComponent_js")]).then(() => () => (__webpack_require__(/*! ./src-c/LazyComponent */ 6)));
+ return Promise.all([__webpack_require__.e("webpack_sharing_consume_default_react"), __webpack_require__.e("src-c_LazyComponent_js")]).then(() => (() => ((__webpack_require__(/*! ./src-c/LazyComponent */ 6)))));
}
};
var get = (module, getScope) => {
@@ -1527,8 +1583,8 @@ var get = (module, getScope) => {
};
var init = (shareScope, initScope) => {
if (!__webpack_require__.S) return;
- var oldScope = __webpack_require__.S["default"];
var name = "default"
+ var oldScope = __webpack_require__.S[name];
if(oldScope && oldScope !== shareScope) throw new Error("Container initialization failed as it has already been initialized with a different share scope");
__webpack_require__.S[name] = shareScope;
return __webpack_require__.I(name, initScope);
@@ -1536,8 +1592,8 @@ var init = (shareScope, initScope) => {
// This exports getters to disallow modifications
__webpack_require__.d(exports, {
- get: () => get,
- init: () => init
+ get: () => (get),
+ init: () => (init)
});
/***/ })
@@ -1554,8 +1610,9 @@ __webpack_require__.d(exports, {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -1574,14 +1631,17 @@ __webpack_require__.d(exports, {
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
+/******/ // expose the module cache
+/******/ __webpack_require__.c = __webpack_module_cache__;
+/******/
/************************************************************************/
/******/ /* webpack/runtime/compat get default export */
/******/ (() => {
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = (module) => {
/******/ var getter = module && module.__esModule ?
-/******/ () => module['default'] :
-/******/ () => module;
+/******/ () => (module['default']) :
+/******/ () => (module);
/******/ __webpack_require__.d(getter, { a: getter });
/******/ return getter;
/******/ };
@@ -1635,7 +1695,7 @@ __webpack_require__.d(exports, {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -1643,7 +1703,7 @@ __webpack_require__.d(exports, {
/******/ var inProgress = {};
/******/ var dataWebpackPrefix = "module-federation-ccc:";
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -1673,10 +1733,9 @@ __webpack_require__.d(exports, {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -1713,34 +1772,38 @@ __webpack_require__.d(exports, {
/******/ if(!__webpack_require__.o(__webpack_require__.S, name)) __webpack_require__.S[name] = {};
/******/ // runs all init snippets from all modules reachable
/******/ var scope = __webpack_require__.S[name];
-/******/ var warn = (msg) => typeof console !== "undefined" && console.warn && console.warn(msg);;
+/******/ var warn = (msg) => {
+/******/ typeof console !== "undefined" && console.warn ? console.warn(msg) : (() => {
+/******/
+/******/ })()
+/******/ };
/******/ var uniqueName = "module-federation-ccc";
-/******/ var register = (name, version, factory) => {
+/******/ var register = (name, version, factory, eager) => {
/******/ var versions = scope[name] = scope[name] || {};
/******/ var activeVersion = versions[version];
-/******/ if(!activeVersion || !activeVersion.loaded && uniqueName > activeVersion.from) versions[version] = { get: factory, from: uniqueName };
+/******/ if(!activeVersion || (!activeVersion.loaded && (!eager != !activeVersion.eager ? eager : uniqueName > activeVersion.from))) versions[version] = { get: factory, from: uniqueName, eager: !!eager };
/******/ };
/******/ var initExternal = (id) => {
-/******/ var handleError = (err) => warn("Initialization of sharing external failed: " + err);
+/******/ var handleError = (err) => (warn("Initialization of sharing external failed: " + err));
/******/ try {
/******/ var module = __webpack_require__(id);
/******/ if(!module) return;
-/******/ var initFn = (module) => module && module.init && module.init(__webpack_require__.S[name], initScope)
+/******/ var initFn = (module) => (module && module.init && module.init(__webpack_require__.S[name], initScope))
/******/ if(module.then) return promises.push(module.then(initFn, handleError));
/******/ var initResult = initFn(module);
-/******/ if(initResult && initResult.then) return promises.push(initResult.catch(handleError));
+/******/ if(initResult && initResult.then) return promises.push(initResult['catch'](handleError));
/******/ } catch(err) { handleError(err); }
/******/ }
/******/ var promises = [];
/******/ switch(name) {
/******/ case "default": {
-/******/ register("date-fns", "2.16.1", () => __webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => () => __webpack_require__(/*! ../../node_modules/date-fns/esm/index.js */ 8)));
-/******/ register("lodash/random", "4.17.20", () => __webpack_require__.e("vendors-node_modules_lodash_random_js").then(() => () => __webpack_require__(/*! ../../node_modules/lodash/random.js */ 240)));
+/******/ register("date-fns", "2.29.3", () => (__webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => (() => (__webpack_require__(/*! ../../node_modules/date-fns/esm/index.js */ 8))))));
+/******/ register("lodash/random", "4.17.21", () => (__webpack_require__.e("vendors-node_modules_lodash_random_js").then(() => (() => (__webpack_require__(/*! ../../node_modules/lodash/random.js */ 321))))));
/******/ }
/******/ break;
/******/ }
/******/ if(!promises.length) return initPromises[name] = 1;
-/******/ return initPromises[name] = Promise.all(promises).then(() => initPromises[name] = 1);
+/******/ return initPromises[name] = Promise.all(promises).then(() => (initPromises[name] = 1));
/******/ };
/******/ })();
/******/
@@ -1761,7 +1824,7 @@ __webpack_require__.d(exports, {
/******/ }
/******/ var rangeToString = (range) => {
/******/ // see webpack/lib/util/semver.js for original code
-/******/ if(1===range.length)return"*";if(0 in range){var r="",n=range[0];r+=0==n?">=":-1==n?"<":1==n?"^":2==n?"~":n>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return r}var g=[];for(a=1;a=":-1==r?"<":1==r?"^":2==r?"~":r>0?"=":"!=";for(var e=1,a=1;a0?".":"")+(e=2,t)}return n}var g=[];for(a=1;a {
/******/ // see webpack/lib/util/semver.js for original code
@@ -1785,17 +1848,21 @@ __webpack_require__.d(exports, {
/******/ return !a || (!versions[a].loaded && versionLt(a, b)) ? b : a;
/******/ }, 0);
/******/ };
-/******/ var getInvalidSingletonVersionMessage = (key, version, requiredVersion) => {
-/******/ return "Unsatisfied version " + version + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"
+/******/ var getInvalidSingletonVersionMessage = (scope, key, version, requiredVersion) => {
+/******/ return "Unsatisfied version " + version + " from " + (version && scope[key][version].from) + " of shared singleton module " + key + " (required " + rangeToString(requiredVersion) + ")"
+/******/ };
+/******/ var getSingleton = (scope, scopeName, key, requiredVersion) => {
+/******/ var version = findSingletonVersionKey(scope, key);
+/******/ return get(scope[key][version]);
/******/ };
/******/ var getSingletonVersion = (scope, scopeName, key, requiredVersion) => {
/******/ var version = findSingletonVersionKey(scope, key);
-/******/ if (!satisfy(requiredVersion, version)) typeof console !== "undefined" && console.warn && console.warn(getInvalidSingletonVersionMessage(key, version, requiredVersion));
+/******/ if (!satisfy(requiredVersion, version)) warn(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));
/******/ return get(scope[key][version]);
/******/ };
/******/ var getStrictSingletonVersion = (scope, scopeName, key, requiredVersion) => {
/******/ var version = findSingletonVersionKey(scope, key);
-/******/ if (!satisfy(requiredVersion, version)) throw new Error(getInvalidSingletonVersionMessage(key, version, requiredVersion));
+/******/ if (!satisfy(requiredVersion, version)) throw new Error(getInvalidSingletonVersionMessage(scope, key, version, requiredVersion));
/******/ return get(scope[key][version]);
/******/ };
/******/ var findValidVersion = (scope, key, requiredVersion) => {
@@ -1818,18 +1885,23 @@ __webpack_require__.d(exports, {
/******/ if(entry) return get(entry);
/******/ throw new Error(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
/******/ };
+/******/ var warn = (msg) => {
+/******/ typeof console !== "undefined" && console.warn ? console.warn(msg) : (() => {
+/******/
+/******/ })()
+/******/ };
/******/ var warnInvalidVersion = (scope, scopeName, key, requiredVersion) => {
-/******/ typeof console !== "undefined" && console.warn && console.warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
+/******/ warn(getInvalidVersionMessage(scope, scopeName, key, requiredVersion));
/******/ };
/******/ var get = (entry) => {
/******/ entry.loaded = 1;
/******/ return entry.get()
/******/ };
-/******/ var init = (fn) => function(scopeName, a, b, c) {
+/******/ var init = (fn) => (function(scopeName, a, b, c) {
/******/ var promise = __webpack_require__.I(scopeName);
/******/ if (promise && promise.then) return promise.then(fn.bind(fn, scopeName, __webpack_require__.S[scopeName], a, b, c));
/******/ return fn(scopeName, __webpack_require__.S[scopeName], a, b, c);
-/******/ };
+/******/ });
/******/
/******/ var load = /*#__PURE__*/ init((scopeName, scope, key) => {
/******/ ensureExistence(scopeName, key);
@@ -1842,6 +1914,10 @@ __webpack_require__.d(exports, {
/******/ ensureExistence(scopeName, key);
/******/ return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));
/******/ });
+/******/ var loadSingleton = /*#__PURE__*/ init((scopeName, scope, key) => {
+/******/ ensureExistence(scopeName, key);
+/******/ return getSingleton(scope, scopeName, key);
+/******/ });
/******/ var loadSingletonVersionCheck = /*#__PURE__*/ init((scopeName, scope, key, version) => {
/******/ ensureExistence(scopeName, key);
/******/ return getSingletonVersion(scope, scopeName, key, version);
@@ -1858,6 +1934,10 @@ __webpack_require__.d(exports, {
/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
/******/ return get(findValidVersion(scope, key, version) || warnInvalidVersion(scope, scopeName, key, version) || findVersion(scope, key));
/******/ });
+/******/ var loadSingletonFallback = /*#__PURE__*/ init((scopeName, scope, key, fallback) => {
+/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
+/******/ return getSingleton(scope, scopeName, key);
+/******/ });
/******/ var loadSingletonVersionCheckFallback = /*#__PURE__*/ init((scopeName, scope, key, version, fallback) => {
/******/ if(!scope || !__webpack_require__.o(scope, key)) return fallback();
/******/ return getSingletonVersion(scope, scopeName, key, version);
@@ -1872,9 +1952,9 @@ __webpack_require__.d(exports, {
/******/ });
/******/ var installedModules = {};
/******/ var moduleToHandlerMapping = {
-/******/ 4: () => loadSingletonVersionCheck("default", "react", [1,17,0,1]),
-/******/ 5: () => loadStrictVersionCheckFallback("default", "date-fns", [1,2,15,0], () => __webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => () => __webpack_require__(/*! date-fns */ 8))),
-/******/ 7: () => loadStrictVersionCheckFallback("default", "lodash/random", [1,4,17,19], () => __webpack_require__.e("vendors-node_modules_lodash_random_js").then(() => () => __webpack_require__(/*! lodash/random */ 240)))
+/******/ 4: () => (loadSingletonVersionCheck("default", "react", [1,18,2,0])),
+/******/ 5: () => (loadStrictVersionCheckFallback("default", "date-fns", [1,2,15,0], () => (__webpack_require__.e("vendors-node_modules_date-fns_esm_index_js").then(() => (() => (__webpack_require__(/*! date-fns */ 8))))))),
+/******/ 7: () => (loadStrictVersionCheckFallback("default", "lodash/random", [1,4,17,19], () => (__webpack_require__.e("vendors-node_modules_lodash_random_js").then(() => (() => (__webpack_require__(/*! lodash/random */ 321)))))))
/******/ };
/******/ // no consumes in initial chunks
/******/ var chunkMapping = {
@@ -1894,22 +1974,22 @@ __webpack_require__.d(exports, {
/******/ if(__webpack_require__.o(installedModules, id)) return promises.push(installedModules[id]);
/******/ var onFactory = (factory) => {
/******/ installedModules[id] = 0;
-/******/ __webpack_modules__[id] = (module) => {
-/******/ delete __webpack_module_cache__[id];
+/******/ __webpack_require__.m[id] = (module) => {
+/******/ delete __webpack_require__.c[id];
/******/ module.exports = factory();
/******/ }
/******/ };
/******/ var onError = (error) => {
/******/ delete installedModules[id];
-/******/ __webpack_modules__[id] = (module) => {
-/******/ delete __webpack_module_cache__[id];
+/******/ __webpack_require__.m[id] = (module) => {
+/******/ delete __webpack_require__.c[id];
/******/ throw error;
/******/ }
/******/ };
/******/ try {
/******/ var promise = moduleToHandlerMapping[id]();
/******/ if(promise.then) {
-/******/ promises.push(installedModules[id] = promise.then(onFactory).catch(onError));
+/******/ promises.push(installedModules[id] = promise.then(onFactory)['catch'](onError));
/******/ } else onFactory(promise);
/******/ } catch(e) { onError(e); }
/******/ });
@@ -1923,12 +2003,11 @@ __webpack_require__.d(exports, {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ "mfeCCC": 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -1940,9 +2019,7 @@ __webpack_require__.d(exports, {
/******/ } else {
/******/ if("webpack_sharing_consume_default_react" != chunkId) {
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -1964,7 +2041,7 @@ __webpack_require__.d(exports, {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -1978,39 +2055,36 @@ __webpack_require__.d(exports, {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunkmodule_federation_ccc"] = self["webpackChunkmodule_federation_ccc"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -2019,10 +2093,13 @@ __webpack_require__.d(exports, {
``` js
-/******/ // module exports must be returned from runtime so entry inlining is disabled
+/******/
+/******/ // module cache are used so entry inlining is disabled
/******/ // startup
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/ mfeCCC = __webpack_exports__;
+/******/
/******/ })()
;
```
@@ -2033,215 +2110,201 @@ __webpack_require__.d(exports, {
```
app:
- asset vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js 163 KiB [emitted] (id hint: vendors)
- asset app.js 29.9 KiB [emitted] (name: app)
- asset node_modules_react_index_js-_11190.js 16.9 KiB [emitted]
- asset node_modules_react_index_js-_11191.js 14.4 KiB [emitted]
- asset src_bootstrap_js-webpack_sharing_consume_default_react_react.js 5.03 KiB [emitted]
- chunk (runtime: app) app.js (app) 669 bytes (javascript) 42 bytes (share-init) 19.2 KiB (runtime) [entry] [rendered]
+ asset vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js 171 KiB [emitted] (id hint: vendors)
+ asset app.js 30.8 KiB [emitted] (name: app)
+ asset node_modules_react_index_js.js 16.6 KiB [emitted]
+ asset src_bootstrap_js.js 4.98 KiB [emitted]
+ chunk (runtime: app) app.js (app) 672 bytes (javascript) 42 bytes (share-init) 19.6 KiB (runtime) [entry] [rendered]
> ./src/index.js app
- runtime modules 19.2 KiB 13 modules
- built modules 669 bytes (javascript) 42 bytes (share-init) [built]
- ./src/index.js 585 bytes [built] [code generated]
+ runtime modules 19.6 KiB 13 modules
+ built modules 672 bytes (javascript) 42 bytes (share-init) [built]
+ ./src/index.js 588 bytes [built] [code generated]
external "mfeBBB@/dist/bbb/mfeBBB.js" 42 bytes [built] [code generated]
external "mfeCCC@/dist/ccc/mfeCCC.js" 42 bytes [built] [code generated]
- provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
- chunk (runtime: app) node_modules_react_index_js-_11190.js 8.54 KiB [rendered]
- > provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js
- dependent modules 8.36 KiB [dependent] 2 modules
- ../../node_modules/react/index.js 190 bytes [built] [code generated]
- chunk (runtime: app) node_modules_react_index_js-_11191.js 6.48 KiB [rendered]
- > consume shared module (default) react@=17.0.1 (singleton) (fallback: ../../node_modules/react/index.js)
- > consume shared module (default) react@^17.0.1 (singleton) (fallback: ../../node_modules/react/index.js)
- dependent modules 6.3 KiB [dependent] 1 module
+ provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
+ chunk (runtime: app) node_modules_react_index_js.js 6.94 KiB [rendered]
+ > provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js
+ > consume shared module (default) react@^18.2.0 (singleton) (fallback: ../../node_modules/react/index.js)
+ dependent modules 6.75 KiB [dependent] 1 module
../../node_modules/react/index.js 190 bytes [built] [code generated]
- chunk (runtime: app) src_bootstrap_js-webpack_sharing_consume_default_react_react.js 1.56 KiB (javascript) 84 bytes (consume-shared) 12 bytes (remote) 12 bytes (share-init) [rendered]
- > ./bootstrap ./src/index.js 8:0-21
- dependent modules 1.19 KiB (javascript) 42 bytes (consume-shared) 12 bytes (remote) 12 bytes (share-init) [dependent] 4 modules
- built modules 382 bytes (javascript) 42 bytes (consume-shared) [built]
- ./src/bootstrap.js 382 bytes [built] [code generated]
- consume shared module (default) react@=17.0.1 (singleton) (fallback: ../../node_modules/react/index.js) 42 bytes [built] [code generated]
- chunk (runtime: app) vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js (id hint: vendors) 142 KiB [rendered] split chunk (cache group: defaultVendors)
- > ./bootstrap ./src/index.js 8:0-21
- dependent modules 139 KiB [dependent] 13 modules
+ chunk (runtime: app) src_bootstrap_js.js 1.56 KiB (javascript) 42 bytes (consume-shared) 12 bytes (remote) 12 bytes (share-init) [rendered]
+ > ./bootstrap ./src/index.js 10:0-21
+ dependent modules 1.18 KiB (javascript) 42 bytes (consume-shared) 12 bytes (remote) 12 bytes (share-init) [dependent] 4 modules
+ ./src/bootstrap.js 381 bytes [built] [code generated]
+ chunk (runtime: app) vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js (id hint: vendors) 151 KiB [rendered] split chunk (cache group: defaultVendors)
+ > ./bootstrap ./src/index.js 10:0-21
+ dependent modules 148 KiB [dependent] 12 modules
cacheable modules 2.3 KiB
../../node_modules/date-fns/esm/locale/de/index.js 995 bytes [built] [code generated]
../../node_modules/react-dom/index.js 1.33 KiB [built] [code generated]
chunk (runtime: app) 6 bytes (remote) 6 bytes (share-init)
- > mfe-c/Component2 ./src/App.js 8:49-75
+ > mfe-c/Component2 ./src/App.js 7:49-75
remote mfe-c/Component2 6 bytes (remote) 6 bytes (share-init) [built] [code generated]
- app (webpack 5.11.1) compiled successfully
+ app (webpack 5.78.0) compiled successfully
mfe-b:
- asset vendors-node_modules_date-fns_esm_index_js.js 857 KiB [emitted] (id hint: vendors)
- asset mfeBBB.js 24.3 KiB [emitted] (name: mfeBBB)
- asset node_modules_react_index_js.js 16.9 KiB [emitted]
- asset src-b_Component_js.js 2.24 KiB [emitted]
- chunk (runtime: mfeBBB) mfeBBB.js (mfeBBB) 42 bytes (javascript) 84 bytes (share-init) 16.4 KiB (runtime) [entry] [rendered]
+ asset vendors-node_modules_date-fns_esm_index_js.js 1.12 MiB [emitted] (id hint: vendors)
+ asset mfeBBB.js 25.5 KiB [emitted] (name: mfeBBB)
+ asset node_modules_react_index_js.js 16.7 KiB [emitted]
+ asset src-b_Component_js.js 2.25 KiB [emitted]
+ chunk (runtime: mfeBBB) mfeBBB.js (mfeBBB) 42 bytes (javascript) 84 bytes (share-init) 17 KiB (runtime) [entry] [rendered]
> mfeBBB
- runtime modules 16.4 KiB 11 modules
+ runtime modules 17 KiB 11 modules
built modules 42 bytes (javascript) 84 bytes (share-init) [built]
container entry 42 bytes [built] [code generated]
- provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
- provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
- chunk (runtime: mfeBBB) node_modules_react_index_js.js 8.54 KiB [rendered]
- > provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js
- > consume shared module (default) react@^17.0.1 (singleton) (fallback: ../../node_modules/react/index.js)
- dependent modules 8.36 KiB [dependent] 2 modules
+ provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
+ provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
+ chunk (runtime: mfeBBB) node_modules_react_index_js.js 6.94 KiB [rendered]
+ > provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js
+ > consume shared module (default) react@^18.2.0 (singleton) (fallback: ../../node_modules/react/index.js)
+ dependent modules 6.75 KiB [dependent] 1 module
../../node_modules/react/index.js 190 bytes [built] [code generated]
- chunk (runtime: mfeBBB) src-b_Component_js.js 753 bytes (javascript) 84 bytes (consume-shared) [rendered]
+ chunk (runtime: mfeBBB) src-b_Component_js.js 752 bytes (javascript) 84 bytes (consume-shared) [rendered]
> ./src-b/Component container entry ./Component
dependent modules 84 bytes [dependent] 2 modules
- ./src-b/Component.js 753 bytes [built] [code generated]
- chunk (runtime: mfeBBB) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 509 KiB [rendered] reused as split chunk (cache group: defaultVendors)
- > provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js
+ ./src-b/Component.js 752 bytes [built] [code generated]
+ chunk (runtime: mfeBBB) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 679 KiB [rendered] reused as split chunk (cache group: defaultVendors)
+ > provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js
> consume shared module (default) date-fns@^2.15.0 (strict) (fallback: ../../node_modules/date-fns/esm/index.js)
- dependent modules 496 KiB [dependent] 231 modules
- ../../node_modules/date-fns/esm/index.js 13.2 KiB [built] [code generated]
- mfe-b (webpack 5.11.1) compiled successfully
+ dependent modules 663 KiB [dependent] 312 modules
+ ../../node_modules/date-fns/esm/index.js 16.2 KiB [built] [code generated]
+ mfe-b (webpack 5.78.0) compiled successfully
mfe-c:
- assets by chunk 880 KiB (id hint: vendors)
- asset vendors-node_modules_date-fns_esm_index_js.js 857 KiB [emitted] (id hint: vendors)
- asset vendors-node_modules_lodash_random_js.js 23.1 KiB [emitted] (id hint: vendors)
- asset mfeCCC.js 25.3 KiB [emitted] (name: mfeCCC)
+ assets by chunk 1.15 MiB (id hint: vendors)
+ asset vendors-node_modules_date-fns_esm_index_js.js 1.12 MiB [emitted] (id hint: vendors)
+ asset vendors-node_modules_lodash_random_js.js 24.8 KiB [emitted] (id hint: vendors)
+ asset mfeCCC.js 26.5 KiB [emitted] (name: mfeCCC)
asset src-c_LazyComponent_js.js 2.05 KiB [emitted]
asset src-c_Component_js.js 1.97 KiB [emitted]
- chunk (runtime: mfeCCC) mfeCCC.js (mfeCCC) 42 bytes (javascript) 84 bytes (share-init) 16.8 KiB (runtime) [entry] [rendered]
+ chunk (runtime: mfeCCC) mfeCCC.js (mfeCCC) 42 bytes (javascript) 84 bytes (share-init) 17.5 KiB (runtime) [entry] [rendered]
> mfeCCC
- runtime modules 16.8 KiB 12 modules
+ runtime modules 17.5 KiB 12 modules
built modules 42 bytes (javascript) 84 bytes (share-init) [built]
container entry 42 bytes [built] [code generated]
- provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
- provide shared module (default) lodash/random@4.17.20 = ../../node_modules/lodash/random.js 42 bytes [built] [code generated]
- chunk (runtime: mfeCCC) src-c_Component_js.js 469 bytes (javascript) 42 bytes (consume-shared) [rendered]
+ provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
+ provide shared module (default) lodash/random@4.17.21 = ../../node_modules/lodash/random.js 42 bytes [built] [code generated]
+ chunk (runtime: mfeCCC) src-c_Component_js.js 467 bytes (javascript) 42 bytes (consume-shared) [rendered]
> ./src-c/Component container entry ./Component
dependent modules 42 bytes [dependent] 1 module
- ./src-c/Component.js 469 bytes [built] [code generated]
- chunk (runtime: mfeCCC) src-c_LazyComponent_js.js 506 bytes (javascript) 42 bytes (consume-shared) [rendered]
+ ./src-c/Component.js 467 bytes [built] [code generated]
+ chunk (runtime: mfeCCC) src-c_LazyComponent_js.js 504 bytes (javascript) 42 bytes (consume-shared) [rendered]
> ./src-c/LazyComponent container entry ./Component2
dependent modules 42 bytes [dependent] 1 module
- ./src-c/LazyComponent.js 506 bytes [built] [code generated]
- chunk (runtime: mfeCCC) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 509 KiB [rendered] reused as split chunk (cache group: defaultVendors)
- > provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js
+ ./src-c/LazyComponent.js 504 bytes [built] [code generated]
+ chunk (runtime: mfeCCC) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 679 KiB [rendered] reused as split chunk (cache group: defaultVendors)
+ > provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js
> consume shared module (default) date-fns@^2.15.0 (strict) (fallback: ../../node_modules/date-fns/esm/index.js)
- dependent modules 496 KiB [dependent] 231 modules
- ../../node_modules/date-fns/esm/index.js 13.2 KiB [built] [code generated]
- chunk (runtime: mfeCCC) vendors-node_modules_lodash_random_js.js (id hint: vendors) 15.2 KiB [rendered] reused as split chunk (cache group: defaultVendors)
- > provide shared module (default) lodash/random@4.17.20 = ../../node_modules/lodash/random.js
+ dependent modules 663 KiB [dependent] 312 modules
+ ../../node_modules/date-fns/esm/index.js 16.2 KiB [built] [code generated]
+ chunk (runtime: mfeCCC) vendors-node_modules_lodash_random_js.js (id hint: vendors) 16 KiB [rendered] reused as split chunk (cache group: defaultVendors)
+ > provide shared module (default) lodash/random@4.17.21 = ../../node_modules/lodash/random.js
> consume shared module (default) lodash/random@^4.17.19 (strict) (fallback: ../../node_modules/lodash/random.js)
- dependent modules 12.8 KiB [dependent] 18 modules
+ dependent modules 13.7 KiB [dependent] 20 modules
../../node_modules/lodash/random.js 2.32 KiB [built] [code generated]
chunk (runtime: mfeCCC) 42 bytes split chunk (cache group: default)
> ./src-c/Component container entry ./Component
> ./src-c/LazyComponent container entry ./Component2
- consume shared module (default) react@^17.0.1 (singleton) 42 bytes [built] [code generated]
- mfe-c (webpack 5.11.1) compiled successfully
+ consume shared module (default) react@^18.2.0 (singleton) 42 bytes [built] [code generated]
+ mfe-c (webpack 5.78.0) compiled successfully
```
## Production mode
```
app:
- asset vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js 128 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
- asset app.js 7.57 KiB [emitted] [minimized] (name: app)
- asset node_modules_react_index_js-_11190.js 7.02 KiB [emitted] [minimized] 1 related asset
- asset node_modules_react_index_js-_11191.js 6.07 KiB [emitted] [minimized] 1 related asset
- asset src_bootstrap_js-webpack_sharing_consume_default_react_react.js 1.08 KiB [emitted] [minimized]
- chunk (runtime: app) app.js (app) 669 bytes (javascript) 42 bytes (share-init) 19.2 KiB (runtime) [entry] [rendered]
+ asset vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js 139 KiB [emitted] [minimized] (id hint: vendors) 1 related asset
+ asset app.js 7.42 KiB [emitted] [minimized] (name: app)
+ asset node_modules_react_index_js.js 6.5 KiB [emitted] [minimized] 1 related asset
+ asset src_bootstrap_js.js 1.04 KiB [emitted] [minimized]
+ chunk (runtime: app) app.js (app) 672 bytes (javascript) 42 bytes (share-init) 19.5 KiB (runtime) [entry] [rendered]
> ./src/index.js app
- runtime modules 19.2 KiB 13 modules
- built modules 669 bytes (javascript) 42 bytes (share-init) [built]
- ./src/index.js 585 bytes [built] [code generated]
+ runtime modules 19.5 KiB 13 modules
+ built modules 672 bytes (javascript) 42 bytes (share-init) [built]
+ ./src/index.js 588 bytes [built] [code generated]
external "mfeBBB@/dist/bbb/mfeBBB.js" 42 bytes [built] [code generated]
external "mfeCCC@/dist/ccc/mfeCCC.js" 42 bytes [built] [code generated]
- provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
- chunk (runtime: app) node_modules_react_index_js-_11190.js 8.54 KiB [rendered]
- > provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js
- dependent modules 8.36 KiB [dependent] 2 modules
- ../../node_modules/react/index.js 190 bytes [built] [code generated]
- chunk (runtime: app) node_modules_react_index_js-_11191.js 6.48 KiB [rendered]
- > consume shared module (default) react@=17.0.1 (singleton) (fallback: ../../node_modules/react/index.js)
- > consume shared module (default) react@^17.0.1 (singleton) (fallback: ../../node_modules/react/index.js)
- dependent modules 6.3 KiB [dependent] 1 module
+ provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
+ chunk (runtime: app) node_modules_react_index_js.js 6.94 KiB [rendered]
+ > provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js
+ > consume shared module (default) react@^18.2.0 (singleton) (fallback: ../../node_modules/react/index.js)
+ dependent modules 6.75 KiB [dependent] 1 module
../../node_modules/react/index.js 190 bytes [built] [code generated]
- chunk (runtime: app) src_bootstrap_js-webpack_sharing_consume_default_react_react.js 84 bytes (consume-shared) 12 bytes (remote) 12 bytes (share-init) 1.56 KiB (javascript) [rendered]
- > ./bootstrap ./src/index.js 8:0-21
+ chunk (runtime: app) src_bootstrap_js.js 42 bytes (consume-shared) 12 bytes (remote) 12 bytes (share-init) 1.56 KiB (javascript) [rendered]
+ > ./bootstrap ./src/index.js 10:0-21
dependent modules 42 bytes (consume-shared) 12 bytes (remote) 12 bytes (share-init) [dependent] 3 modules
- built modules 1.56 KiB (javascript) 42 bytes (consume-shared) [built]
- ./src/bootstrap.js + 1 modules 1.56 KiB [built] [code generated]
- consume shared module (default) react@=17.0.1 (singleton) (fallback: ../../node_modules/react/index.js) 42 bytes [built] [code generated]
- chunk (runtime: app) vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js (id hint: vendors) 142 KiB [rendered] split chunk (cache group: defaultVendors)
- > ./bootstrap ./src/index.js 8:0-21
- dependent modules 125 KiB [dependent] 4 modules
- cacheable modules 16.9 KiB
- ../../node_modules/date-fns/esm/locale/de/index.js + 9 modules 15.6 KiB [built] [code generated]
+ ./src/bootstrap.js + 1 modules 1.56 KiB [built] [code generated]
+ chunk (runtime: app) vendors-node_modules_date-fns_esm_locale_de_index_js-node_modules_react-dom_index_js.js (id hint: vendors) 151 KiB [rendered] split chunk (cache group: defaultVendors)
+ > ./bootstrap ./src/index.js 10:0-21
+ dependent modules 133 KiB [dependent] 3 modules
+ cacheable modules 17.5 KiB
+ ../../node_modules/date-fns/esm/locale/de/index.js + 9 modules 16.2 KiB [built] [code generated]
../../node_modules/react-dom/index.js 1.33 KiB [built] [code generated]
chunk (runtime: app) 6 bytes (remote) 6 bytes (share-init)
- > mfe-c/Component2 ./src/App.js 8:49-75
+ > mfe-c/Component2 ./src/App.js 7:49-75
remote mfe-c/Component2 6 bytes (remote) 6 bytes (share-init) [built] [code generated]
- app (webpack 5.11.1) compiled successfully
+ app (webpack 5.78.0) compiled successfully
mfe-b:
- asset vendors-node_modules_date-fns_esm_index_js.js 78 KiB [emitted] [minimized] (id hint: vendors)
- asset node_modules_react_index_js.js 6.97 KiB [emitted] [minimized] 1 related asset
- asset mfeBBB.js 5.76 KiB [emitted] [minimized] (name: mfeBBB)
+ asset vendors-node_modules_date-fns_esm_index_js.js 154 KiB [emitted] [minimized] (id hint: vendors)
+ asset node_modules_react_index_js.js 6.5 KiB [emitted] [minimized] 1 related asset
+ asset mfeBBB.js 5.82 KiB [emitted] [minimized] (name: mfeBBB)
asset src-b_Component_js.js 489 bytes [emitted] [minimized]
- chunk (runtime: mfeBBB) mfeBBB.js (mfeBBB) 42 bytes (javascript) 84 bytes (share-init) 16.3 KiB (runtime) [entry] [rendered]
+ chunk (runtime: mfeBBB) mfeBBB.js (mfeBBB) 42 bytes (javascript) 84 bytes (share-init) 16.9 KiB (runtime) [entry] [rendered]
> mfeBBB
- runtime modules 16.3 KiB 11 modules
+ runtime modules 16.9 KiB 11 modules
built modules 42 bytes (javascript) 84 bytes (share-init) [built]
container entry 42 bytes [built] [code generated]
- provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
- provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
- chunk (runtime: mfeBBB) node_modules_react_index_js.js 8.54 KiB [rendered]
- > provide shared module (default) react@17.0.1 = ../../node_modules/react/index.js
- > consume shared module (default) react@^17.0.1 (singleton) (fallback: ../../node_modules/react/index.js)
- dependent modules 8.36 KiB [dependent] 2 modules
+ provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
+ provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js 42 bytes [built] [code generated]
+ chunk (runtime: mfeBBB) node_modules_react_index_js.js 6.94 KiB [rendered]
+ > provide shared module (default) react@18.2.0 = ../../node_modules/react/index.js
+ > consume shared module (default) react@^18.2.0 (singleton) (fallback: ../../node_modules/react/index.js)
+ dependent modules 6.75 KiB [dependent] 1 module
../../node_modules/react/index.js 190 bytes [built] [code generated]
- chunk (runtime: mfeBBB) src-b_Component_js.js 753 bytes (javascript) 84 bytes (consume-shared) [rendered]
+ chunk (runtime: mfeBBB) src-b_Component_js.js 752 bytes (javascript) 84 bytes (consume-shared) [rendered]
> ./src-b/Component container entry ./Component
dependent modules 84 bytes [dependent] 2 modules
- ./src-b/Component.js 753 bytes [built] [code generated]
- chunk (runtime: mfeBBB) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 509 KiB [rendered] reused as split chunk (cache group: defaultVendors)
+ ./src-b/Component.js 752 bytes [built] [code generated]
+ chunk (runtime: mfeBBB) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 679 KiB [rendered] reused as split chunk (cache group: defaultVendors)
+ > provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js
> consume shared module (default) date-fns@^2.15.0 (strict) (fallback: ../../node_modules/date-fns/esm/index.js)
- > provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js
- ../../node_modules/date-fns/esm/index.js + 231 modules 509 KiB [built] [code generated]
- mfe-b (webpack 5.11.1) compiled successfully
+ ../../node_modules/date-fns/esm/index.js + 312 modules 679 KiB [built] [code generated]
+ mfe-b (webpack 5.78.0) compiled successfully
mfe-c:
- asset vendors-node_modules_date-fns_esm_index_js.js 78 KiB [emitted] [minimized] (id hint: vendors)
- asset mfeCCC.js 6.41 KiB [emitted] [minimized] (name: mfeCCC)
- asset node_modules_lodash_random_js.js 2.95 KiB [emitted] [minimized]
- asset src-c_LazyComponent_js.js 533 bytes [emitted] [minimized]
- asset src-c_Component_js.js 489 bytes [emitted] [minimized]
- chunk (runtime: mfeCCC) mfeCCC.js (mfeCCC) 42 bytes (javascript) 84 bytes (share-init) 16.7 KiB (runtime) [entry] [rendered]
+ asset vendors-node_modules_date-fns_esm_index_js.js 154 KiB [emitted] [minimized] (id hint: vendors)
+ asset mfeCCC.js 6.47 KiB [emitted] [minimized] (name: mfeCCC)
+ asset node_modules_lodash_random_js.js 3.13 KiB [emitted] [minimized]
+ asset src-c_LazyComponent_js.js 532 bytes [emitted] [minimized]
+ asset src-c_Component_js.js 488 bytes [emitted] [minimized]
+ chunk (runtime: mfeCCC) mfeCCC.js (mfeCCC) 42 bytes (javascript) 84 bytes (share-init) 17.3 KiB (runtime) [entry] [rendered]
> mfeCCC
- runtime modules 16.7 KiB 12 modules
+ runtime modules 17.3 KiB 12 modules
built modules 42 bytes (javascript) 84 bytes (share-init) [built]
container entry 42 bytes [built] [code generated]
- provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
- provide shared module (default) lodash/random@4.17.20 = ../../node_modules/lodash/random.js 42 bytes [built] [code generated]
- chunk (runtime: mfeCCC) node_modules_lodash_random_js.js 15.2 KiB [rendered]
- > provide shared module (default) lodash/random@4.17.20 = ../../node_modules/lodash/random.js
+ provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js 42 bytes [built] [code generated]
+ provide shared module (default) lodash/random@4.17.21 = ../../node_modules/lodash/random.js 42 bytes [built] [code generated]
+ chunk (runtime: mfeCCC) node_modules_lodash_random_js.js 16 KiB [rendered]
+ > provide shared module (default) lodash/random@4.17.21 = ../../node_modules/lodash/random.js
> consume shared module (default) lodash/random@^4.17.19 (strict) (fallback: ../../node_modules/lodash/random.js)
- dependent modules 12.8 KiB [dependent] 18 modules
+ dependent modules 13.7 KiB [dependent] 20 modules
../../node_modules/lodash/random.js 2.32 KiB [built] [code generated]
- chunk (runtime: mfeCCC) src-c_Component_js.js 469 bytes (javascript) 42 bytes (consume-shared) [rendered]
+ chunk (runtime: mfeCCC) src-c_Component_js.js 467 bytes (javascript) 42 bytes (consume-shared) [rendered]
> ./src-c/Component container entry ./Component
dependent modules 42 bytes [dependent] 1 module
- ./src-c/Component.js 469 bytes [built] [code generated]
- chunk (runtime: mfeCCC) src-c_LazyComponent_js.js 506 bytes (javascript) 42 bytes (consume-shared) [rendered]
+ ./src-c/Component.js 467 bytes [built] [code generated]
+ chunk (runtime: mfeCCC) src-c_LazyComponent_js.js 504 bytes (javascript) 42 bytes (consume-shared) [rendered]
> ./src-c/LazyComponent container entry ./Component2
dependent modules 42 bytes [dependent] 1 module
- ./src-c/LazyComponent.js 506 bytes [built] [code generated]
- chunk (runtime: mfeCCC) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 509 KiB [rendered] reused as split chunk (cache group: defaultVendors)
+ ./src-c/LazyComponent.js 504 bytes [built] [code generated]
+ chunk (runtime: mfeCCC) vendors-node_modules_date-fns_esm_index_js.js (id hint: vendors) 679 KiB [rendered] reused as split chunk (cache group: defaultVendors)
+ > provide shared module (default) date-fns@2.29.3 = ../../node_modules/date-fns/esm/index.js
> consume shared module (default) date-fns@^2.15.0 (strict) (fallback: ../../node_modules/date-fns/esm/index.js)
- > provide shared module (default) date-fns@2.16.1 = ../../node_modules/date-fns/esm/index.js
- ../../node_modules/date-fns/esm/index.js + 231 modules 509 KiB [built] [code generated]
+ ../../node_modules/date-fns/esm/index.js + 312 modules 679 KiB [built] [code generated]
chunk (runtime: mfeCCC) 42 bytes split chunk (cache group: default)
> ./src-c/Component container entry ./Component
> ./src-c/LazyComponent container entry ./Component2
- consume shared module (default) react@^17.0.1 (singleton) 42 bytes [built] [code generated]
- mfe-c (webpack 5.11.1) compiled successfully
+ consume shared module (default) react@^18.2.0 (singleton) 42 bytes [built] [code generated]
+ mfe-c (webpack 5.78.0) compiled successfully
```
diff --git a/examples/module-federation/index.html b/examples/module-federation/index.html
index 3bb627ed79c..f5a0a1ec244 100644
--- a/examples/module-federation/index.html
+++ b/examples/module-federation/index.html
@@ -67,7 +67,7 @@
-
+
diff --git a/examples/module-library/README.md b/examples/module-library/README.md
new file mode 100644
index 00000000000..ceea855eef9
--- /dev/null
+++ b/examples/module-library/README.md
@@ -0,0 +1,169 @@
+# example.js
+
+```javascript
+export * from "./counter";
+export * from "./methods";
+```
+
+# methods.js
+
+```javascript
+export { reset as resetCounter } from "./counter";
+
+export const print = value => console.log(value);
+```
+
+# counter.js
+
+```javascript
+export let value = 0;
+export function increment() {
+ value++;
+}
+export function decrement() {
+ value--;
+}
+export function reset() {
+ value = 0;
+}
+```
+
+# dist/output.js
+
+```javascript
+/******/ // The require scope
+/******/ var __webpack_require__ = {};
+/******/
+```
+
+/* webpack runtime code */
+
+``` js
+/************************************************************************/
+/******/ /* webpack/runtime/define property getters */
+/******/ (() => {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = (exports, definition) => {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ (() => {
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
+/******/ })();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ (() => {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = (exports) => {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ })();
+/******/
+/************************************************************************/
+```
+
+
+
+``` js
+var __webpack_exports__ = {};
+/*!********************************!*\
+ !*** ./example.js + 2 modules ***!
+ \********************************/
+/*! namespace exports */
+/*! export decrement [provided] [used in main] [missing usage info prevents renaming] -> ./counter.js .decrement */
+/*! export increment [provided] [used in main] [missing usage info prevents renaming] -> ./counter.js .increment */
+/*! export print [provided] [used in main] [missing usage info prevents renaming] -> ./methods.js .print */
+/*! export reset [provided] [used in main] [missing usage info prevents renaming] -> ./counter.js .reset */
+/*! export resetCounter [provided] [used in main] [missing usage info prevents renaming] -> ./counter.js .reset */
+/*! export value [provided] [used in main] [missing usage info prevents renaming] -> ./counter.js .value */
+/*! other exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
+// ESM COMPAT FLAG
+__webpack_require__.r(__webpack_exports__);
+
+// EXPORTS
+__webpack_require__.d(__webpack_exports__, {
+ "decrement": () => (/* reexport */ decrement),
+ "increment": () => (/* reexport */ increment),
+ "print": () => (/* reexport */ print),
+ "reset": () => (/* reexport */ counter_reset),
+ "resetCounter": () => (/* reexport */ counter_reset),
+ "value": () => (/* reexport */ value)
+});
+
+;// CONCATENATED MODULE: ./counter.js
+let value = 0;
+function increment() {
+ value++;
+}
+function decrement() {
+ value--;
+}
+function counter_reset() {
+ value = 0;
+}
+
+;// CONCATENATED MODULE: ./methods.js
+
+
+const print = value => console.log(value);
+
+;// CONCATENATED MODULE: ./example.js
+
+
+
+var __webpack_exports__decrement = __webpack_exports__.decrement;
+var __webpack_exports__increment = __webpack_exports__.increment;
+var __webpack_exports__print = __webpack_exports__.print;
+var __webpack_exports__reset = __webpack_exports__.reset;
+var __webpack_exports__resetCounter = __webpack_exports__.resetCounter;
+var __webpack_exports__value = __webpack_exports__.value;
+export { __webpack_exports__decrement as decrement, __webpack_exports__increment as increment, __webpack_exports__print as print, __webpack_exports__reset as reset, __webpack_exports__resetCounter as resetCounter, __webpack_exports__value as value };
+```
+
+# dist/output.js (production)
+
+```javascript
+var e={d:(n,t)=>{for(var o in t)e.o(t,o)&&!e.o(n,o)&&Object.defineProperty(n,o,{enumerable:!0,get:t[o]})},o:(e,n)=>Object.prototype.hasOwnProperty.call(e,n)},n={};e.d(n,{Mj:()=>r,nP:()=>o,S0:()=>c,mc:()=>a,Uh:()=>a,S3:()=>t});let t=0;function o(){t++}function r(){t--}function a(){t=0}const c=e=>console.log(e);var s=n.Mj,i=n.nP,l=n.S0,p=n.mc,u=n.Uh,f=n.S3;export{s as decrement,i as increment,l as print,p as reset,u as resetCounter,f as value};
+```
+
+# Info
+
+## Unoptimized
+
+```
+asset output.js 3.61 KiB [emitted] [javascript module] (name: main)
+chunk (runtime: main) output.js (main) 302 bytes (javascript) 670 bytes (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 670 bytes 3 modules
+ ./example.js + 2 modules 302 bytes [built] [code generated]
+ [exports: decrement, increment, print, reset, resetCounter, value]
+ [used exports unknown]
+ entry ./example.js main
+ used as library export
+webpack 5.78.0 compiled successfully
+```
+
+## Production mode
+
+```
+asset output.js 446 bytes [emitted] [javascript module] [minimized] (name: main)
+chunk (runtime: main) output.js (main) 302 bytes (javascript) 396 bytes (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 396 bytes 2 modules
+ ./example.js + 2 modules 302 bytes [built] [code generated]
+ [exports: decrement, increment, print, reset, resetCounter, value]
+ [all exports used]
+ entry ./example.js main
+ used as library export
+webpack 5.78.0 compiled successfully
+```
diff --git a/examples/module-library/build.js b/examples/module-library/build.js
new file mode 100644
index 00000000000..41c29c9d169
--- /dev/null
+++ b/examples/module-library/build.js
@@ -0,0 +1 @@
+require("../build-common");
\ No newline at end of file
diff --git a/examples/module-library/counter.js b/examples/module-library/counter.js
new file mode 100644
index 00000000000..7009896e282
--- /dev/null
+++ b/examples/module-library/counter.js
@@ -0,0 +1,10 @@
+export let value = 0;
+export function increment() {
+ value++;
+}
+export function decrement() {
+ value--;
+}
+export function reset() {
+ value = 0;
+}
diff --git a/examples/module-library/example.js b/examples/module-library/example.js
new file mode 100644
index 00000000000..ef58a21ffa1
--- /dev/null
+++ b/examples/module-library/example.js
@@ -0,0 +1,2 @@
+export * from "./counter";
+export * from "./methods";
diff --git a/examples/module-library/methods.js b/examples/module-library/methods.js
new file mode 100644
index 00000000000..4be8f10f704
--- /dev/null
+++ b/examples/module-library/methods.js
@@ -0,0 +1,3 @@
+export { reset as resetCounter } from "./counter";
+
+export const print = value => console.log(value);
diff --git a/examples/module-library/template.md b/examples/module-library/template.md
new file mode 100644
index 00000000000..98d06e62ec9
--- /dev/null
+++ b/examples/module-library/template.md
@@ -0,0 +1,43 @@
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# methods.js
+
+```javascript
+_{{methods.js}}_
+```
+
+# counter.js
+
+```javascript
+_{{counter.js}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# dist/output.js (production)
+
+```javascript
+_{{production:dist/output.js}}_
+```
+
+# Info
+
+## Unoptimized
+
+```
+_{{stdout}}_
+```
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/module-library/webpack.config.js b/examples/module-library/webpack.config.js
new file mode 100644
index 00000000000..d7f45aa6917
--- /dev/null
+++ b/examples/module-library/webpack.config.js
@@ -0,0 +1,14 @@
+module.exports = {
+ output: {
+ module: true,
+ library: {
+ type: "module"
+ }
+ },
+ optimization: {
+ concatenateModules: true
+ },
+ experiments: {
+ outputModule: true
+ }
+};
diff --git a/examples/module-worker/README.md b/examples/module-worker/README.md
new file mode 100644
index 00000000000..3ec3b5f1452
--- /dev/null
+++ b/examples/module-worker/README.md
@@ -0,0 +1,896 @@
+# example.js
+
+```javascript
+document.body.innerHTML = `
+
+
+ Computing fibonacci without worker:
+
+
+ Computing fibonacci with worker:
+
+
+`;
+
+const history = document.getElementById("history");
+const message = document.getElementById("message");
+const send = document.getElementById("send");
+const fib1 = document.getElementById("fib1");
+const output1 = document.getElementById("output1");
+const fib2 = document.getElementById("fib2");
+const output2 = document.getElementById("output2");
+
+/// CHAT with shared worker ///
+
+const chatWorker = new SharedWorker(
+ new URL("./chat-worker.js", import.meta.url),
+ {
+ name: "chat",
+ type: "module"
+ }
+);
+
+let historyTimeout;
+const scheduleUpdateHistory = () => {
+ clearTimeout(historyTimeout);
+ historyTimeout = setTimeout(() => {
+ chatWorker.port.postMessage({ type: "history" });
+ }, 1000);
+};
+scheduleUpdateHistory();
+
+const from = `User ${Math.floor(Math.random() * 10000)}`;
+
+send.addEventListener("click", e => {
+ chatWorker.port.postMessage({
+ type: "message",
+ content: message.value,
+ from
+ });
+ message.value = "";
+ message.focus();
+ e.preventDefault();
+});
+
+chatWorker.port.onmessage = event => {
+ const msg = event.data;
+ switch (msg.type) {
+ case "history":
+ history.innerText = msg.history.join("\n");
+ scheduleUpdateHistory();
+ break;
+ }
+};
+
+/// FIBONACCI without worker ///
+
+fib1.addEventListener("change", async () => {
+ try {
+ const value = parseInt(fib1.value, 10);
+ const { fibonacci } = await import("./fibonacci");
+ const result = fibonacci(value);
+ output1.innerText = `fib(${value}) = ${result}`;
+ } catch (e) {
+ output1.innerText = e.message;
+ }
+});
+
+/// FIBONACCI with worker ///
+
+const fibWorker = new Worker(new URL("./fib-worker.js", import.meta.url), {
+ name: "fibonacci",
+ type: "module"
+ /* webpackEntryOptions: { filename: "workers/[name].js" } */
+});
+
+fib2.addEventListener("change", () => {
+ try {
+ const value = parseInt(fib2.value, 10);
+ fibWorker.postMessage(`${value}`);
+ } catch (e) {
+ output2.innerText = e.message;
+ }
+});
+
+fibWorker.onmessage = event => {
+ output2.innerText = event.data;
+};
+```
+
+# fib-worker.js
+
+```javascript
+onmessage = async event => {
+ const { fibonacci } = await import("./fibonacci");
+ const value = JSON.parse(event.data);
+ postMessage(`fib(${value}) = ${fibonacci(value)}`);
+};
+```
+
+# fibonacci.js
+
+```javascript
+export function fibonacci(n) {
+ return n < 1 ? 0 : n <= 2 ? 1 : fibonacci(n - 1) + fibonacci(n - 2);
+}
+```
+
+# chat-worker.js
+
+```javascript
+onconnect = function (e) {
+ for (const port of e.ports) {
+ port.onmessage = async event => {
+ const msg = event.data;
+ switch (msg.type) {
+ case "message":
+ const { add } = await import("./chat-module");
+ add(msg.content, msg.from);
+ // fallthrough
+ case "history":
+ const { history } = await import("./chat-module");
+ port.postMessage({
+ type: "history",
+ history
+ });
+ break;
+ }
+ };
+ }
+};
+```
+
+# chat-module.js
+
+```javascript
+export const history = [];
+
+export const add = (content, from) => {
+ if (history.length > 10) history.shift();
+ history.push(`${from}: ${content}`);
+};
+```
+
+# dist/main.js
+
+```javascript
+/******/ var __webpack_modules__ = ({});
+```
+
+/* webpack runtime code */
+
+``` js
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = __webpack_modules__;
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/define property getters */
+/******/ (() => {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = (exports, definition) => {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/ensure chunk */
+/******/ (() => {
+/******/ __webpack_require__.f = {};
+/******/ // This file contains only the entry chunk.
+/******/ // The chunk loading function for additional chunks
+/******/ __webpack_require__.e = (chunkId) => {
+/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
+/******/ __webpack_require__.f[key](chunkId, promises);
+/******/ return promises;
+/******/ }, []));
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/get javascript chunk filename */
+/******/ (() => {
+/******/ // This function allow to reference async chunks
+/******/ __webpack_require__.u = (chunkId) => {
+/******/ // return url for filenames not based on template
+/******/ if (chunkId === 631) return "workers/fibonacci.js";
+/******/ // return url for filenames based on template
+/******/ return "" + (chunkId === 348 ? "chat" : chunkId) + ".js";
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ (() => {
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
+/******/ })();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ (() => {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = (exports) => {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/publicPath */
+/******/ (() => {
+/******/ __webpack_require__.p = "/dist/";
+/******/ })();
+/******/
+/******/ /* webpack/runtime/import chunk loading */
+/******/ (() => {
+/******/ __webpack_require__.b = new URL("./", import.meta.url);
+/******/
+/******/ // object to store loaded and loading chunks
+/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
+/******/ var installedChunks = {
+/******/ 179: 0
+/******/ };
+/******/
+/******/ var installChunk = (data) => {
+/******/ var {ids, modules, runtime} = data;
+/******/ // add "modules" to the modules object,
+/******/ // then flag all "ids" as loaded and fire callback
+/******/ var moduleId, chunkId, i = 0;
+/******/ for(moduleId in modules) {
+/******/ if(__webpack_require__.o(modules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = modules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) runtime(__webpack_require__);
+/******/ for(;i < ids.length; i++) {
+/******/ chunkId = ids[i];
+/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
+/******/ installedChunks[chunkId][0]();
+/******/ }
+/******/ installedChunks[ids[i]] = 0;
+/******/ }
+/******/
+/******/ }
+/******/
+/******/ __webpack_require__.f.j = (chunkId, promises) => {
+/******/ // import() chunk loading for javascript
+/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
+/******/ if(installedChunkData !== 0) { // 0 means "already installed".
+/******/
+/******/ // a Promise means "currently loading".
+/******/ if(installedChunkData) {
+/******/ promises.push(installedChunkData[1]);
+/******/ } else {
+/******/ if(true) { // all chunks have JS
+/******/ // setup Promise in chunk cache
+/******/ var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e) => {
+/******/ if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;
+/******/ throw e;
+/******/ });
+/******/ var promise = Promise.race([promise, new Promise((resolve) => (installedChunkData = installedChunks[chunkId] = [resolve]))])
+/******/ promises.push(installedChunkData[1] = promise);
+/******/ } else installedChunks[chunkId] = 0;
+/******/ }
+/******/ }
+/******/ };
+/******/
+/******/ // no external install chunk
+/******/
+/******/ // no on chunks loaded
+/******/ })();
+/******/
+/************************************************************************/
+```
+
+
+
+``` js
+var __webpack_exports__ = {};
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: __webpack_require__.p, __webpack_require__.b, __webpack_require__.u, __webpack_require__.e, __webpack_require__, __webpack_require__.* */
+document.body.innerHTML = `
+
+
+ Computing fibonacci without worker:
+
+
+ Computing fibonacci with worker:
+
+
+`;
+
+const history = document.getElementById("history");
+const message = document.getElementById("message");
+const send = document.getElementById("send");
+const fib1 = document.getElementById("fib1");
+const output1 = document.getElementById("output1");
+const fib2 = document.getElementById("fib2");
+const output2 = document.getElementById("output2");
+
+/// CHAT with shared worker ///
+
+const chatWorker = new SharedWorker(
+ new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u(348), __webpack_require__.b),
+ {
+ name: "chat",
+ type: "module"
+ }
+);
+
+let historyTimeout;
+const scheduleUpdateHistory = () => {
+ clearTimeout(historyTimeout);
+ historyTimeout = setTimeout(() => {
+ chatWorker.port.postMessage({ type: "history" });
+ }, 1000);
+};
+scheduleUpdateHistory();
+
+const from = `User ${Math.floor(Math.random() * 10000)}`;
+
+send.addEventListener("click", e => {
+ chatWorker.port.postMessage({
+ type: "message",
+ content: message.value,
+ from
+ });
+ message.value = "";
+ message.focus();
+ e.preventDefault();
+});
+
+chatWorker.port.onmessage = event => {
+ const msg = event.data;
+ switch (msg.type) {
+ case "history":
+ history.innerText = msg.history.join("\n");
+ scheduleUpdateHistory();
+ break;
+ }
+};
+
+/// FIBONACCI without worker ///
+
+fib1.addEventListener("change", async () => {
+ try {
+ const value = parseInt(fib1.value, 10);
+ const { fibonacci } = await __webpack_require__.e(/*! import() */ 129).then(__webpack_require__.bind(__webpack_require__, /*! ./fibonacci */ 2));
+ const result = fibonacci(value);
+ output1.innerText = `fib(${value}) = ${result}`;
+ } catch (e) {
+ output1.innerText = e.message;
+ }
+});
+
+/// FIBONACCI with worker ///
+
+const fibWorker = new Worker(new URL(/* worker import */ __webpack_require__.p + __webpack_require__.u(631), __webpack_require__.b), {
+ name: "fibonacci",
+ type: "module"
+ /* webpackEntryOptions: { filename: "workers/[name].js" } */
+});
+
+fib2.addEventListener("change", () => {
+ try {
+ const value = parseInt(fib2.value, 10);
+ fibWorker.postMessage(`${value}`);
+ } catch (e) {
+ output2.innerText = e.message;
+ }
+});
+
+fibWorker.onmessage = event => {
+ output2.innerText = event.data;
+};
+```
+
+# dist/chat.js
+
+```javascript
+/******/ var __webpack_modules__ = ({});
+```
+
+/* webpack runtime code */
+
+``` js
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = __webpack_modules__;
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/define property getters */
+/******/ (() => {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = (exports, definition) => {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/ensure chunk */
+/******/ (() => {
+/******/ __webpack_require__.f = {};
+/******/ // This file contains only the entry chunk.
+/******/ // The chunk loading function for additional chunks
+/******/ __webpack_require__.e = (chunkId) => {
+/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
+/******/ __webpack_require__.f[key](chunkId, promises);
+/******/ return promises;
+/******/ }, []));
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/get javascript chunk filename */
+/******/ (() => {
+/******/ // This function allow to reference async chunks
+/******/ __webpack_require__.u = (chunkId) => {
+/******/ // return url for filenames based on template
+/******/ return "" + chunkId + ".js";
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ (() => {
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
+/******/ })();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ (() => {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = (exports) => {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/import chunk loading */
+/******/ (() => {
+/******/ // no baseURI
+/******/
+/******/ // object to store loaded and loading chunks
+/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
+/******/ var installedChunks = {
+/******/ 348: 0
+/******/ };
+/******/
+/******/ var installChunk = (data) => {
+/******/ var {ids, modules, runtime} = data;
+/******/ // add "modules" to the modules object,
+/******/ // then flag all "ids" as loaded and fire callback
+/******/ var moduleId, chunkId, i = 0;
+/******/ for(moduleId in modules) {
+/******/ if(__webpack_require__.o(modules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = modules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) runtime(__webpack_require__);
+/******/ for(;i < ids.length; i++) {
+/******/ chunkId = ids[i];
+/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
+/******/ installedChunks[chunkId][0]();
+/******/ }
+/******/ installedChunks[ids[i]] = 0;
+/******/ }
+/******/
+/******/ }
+/******/
+/******/ __webpack_require__.f.j = (chunkId, promises) => {
+/******/ // import() chunk loading for javascript
+/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
+/******/ if(installedChunkData !== 0) { // 0 means "already installed".
+/******/
+/******/ // a Promise means "currently loading".
+/******/ if(installedChunkData) {
+/******/ promises.push(installedChunkData[1]);
+/******/ } else {
+/******/ if(true) { // all chunks have JS
+/******/ // setup Promise in chunk cache
+/******/ var promise = import("./" + __webpack_require__.u(chunkId)).then(installChunk, (e) => {
+/******/ if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;
+/******/ throw e;
+/******/ });
+/******/ var promise = Promise.race([promise, new Promise((resolve) => (installedChunkData = installedChunks[chunkId] = [resolve]))])
+/******/ promises.push(installedChunkData[1] = promise);
+/******/ } else installedChunks[chunkId] = 0;
+/******/ }
+/******/ }
+/******/ };
+/******/
+/******/ // no external install chunk
+/******/
+/******/ // no on chunks loaded
+/******/ })();
+/******/
+/************************************************************************/
+```
+
+
+
+``` js
+var __webpack_exports__ = {};
+/*!************************!*\
+ !*** ./chat-worker.js ***!
+ \************************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: __webpack_require__.e, __webpack_require__, __webpack_require__.* */
+onconnect = function (e) {
+ for (const port of e.ports) {
+ port.onmessage = async event => {
+ const msg = event.data;
+ switch (msg.type) {
+ case "message":
+ const { add } = await __webpack_require__.e(/*! import() */ 192).then(__webpack_require__.bind(__webpack_require__, /*! ./chat-module */ 4));
+ add(msg.content, msg.from);
+ // fallthrough
+ case "history":
+ const { history } = await __webpack_require__.e(/*! import() */ 192).then(__webpack_require__.bind(__webpack_require__, /*! ./chat-module */ 4));
+ port.postMessage({
+ type: "history",
+ history
+ });
+ break;
+ }
+ };
+ }
+};
+```
+
+```javascript
+var e,o,t={},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var s=r[e]={exports:{}};return t[e](s,s.exports,n),s.exports}n.m=t,n.d=(e,o)=>{for(var t in o)n.o(o,t)&&!n.o(e,t)&&Object.defineProperty(e,t,{enumerable:!0,get:o[t]})},n.f={},n.e=e=>Promise.all(Object.keys(n.f).reduce(((o,t)=>(n.f[t](e,o),o)),[])),n.u=e=>e+".js",n.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e={348:0},o=o=>{var t,r,{ids:s,modules:i,runtime:a}=o,c=0;for(t in i)n.o(i,t)&&(n.m[t]=i[t]);for(a&&a(n);c{var s=n.o(e,t)?e[t]:void 0;if(0!==s)if(s)r.push(s[1]);else{var i=import("./"+n.u(t)).then(o,(o=>{throw 0!==e[t]&&(e[t]=void 0),o}));i=Promise.race([i,new Promise((o=>s=e[t]=[o]))]),r.push(s[1]=i)}},onconnect=function(e){for(const o of e.ports)o.onmessage=async e=>{const t=e.data;switch(t.type){case"message":const{add:e}=await n.e(192).then(n.bind(n,192));e(t.content,t.from);case"history":const{history:r}=await n.e(192).then(n.bind(n,192));o.postMessage({type:"history",history:r})}}};
+```
+
+# dist/workers/fibonacci.js
+
+```javascript
+/******/ var __webpack_modules__ = ({});
+```
+
+/* webpack runtime code */
+
+``` js
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ // no module.id needed
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/******/ // expose the modules object (__webpack_modules__)
+/******/ __webpack_require__.m = __webpack_modules__;
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/define property getters */
+/******/ (() => {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = (exports, definition) => {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/ensure chunk */
+/******/ (() => {
+/******/ __webpack_require__.f = {};
+/******/ // This file contains only the entry chunk.
+/******/ // The chunk loading function for additional chunks
+/******/ __webpack_require__.e = (chunkId) => {
+/******/ return Promise.all(Object.keys(__webpack_require__.f).reduce((promises, key) => {
+/******/ __webpack_require__.f[key](chunkId, promises);
+/******/ return promises;
+/******/ }, []));
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/get javascript chunk filename */
+/******/ (() => {
+/******/ // This function allow to reference async chunks
+/******/ __webpack_require__.u = (chunkId) => {
+/******/ // return url for filenames based on template
+/******/ return "" + chunkId + ".js";
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ (() => {
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
+/******/ })();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ (() => {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = (exports) => {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/import chunk loading */
+/******/ (() => {
+/******/ // no baseURI
+/******/
+/******/ // object to store loaded and loading chunks
+/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
+/******/ var installedChunks = {
+/******/ 631: 0
+/******/ };
+/******/
+/******/ var installChunk = (data) => {
+/******/ var {ids, modules, runtime} = data;
+/******/ // add "modules" to the modules object,
+/******/ // then flag all "ids" as loaded and fire callback
+/******/ var moduleId, chunkId, i = 0;
+/******/ for(moduleId in modules) {
+/******/ if(__webpack_require__.o(modules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = modules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) runtime(__webpack_require__);
+/******/ for(;i < ids.length; i++) {
+/******/ chunkId = ids[i];
+/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
+/******/ installedChunks[chunkId][0]();
+/******/ }
+/******/ installedChunks[ids[i]] = 0;
+/******/ }
+/******/
+/******/ }
+/******/
+/******/ __webpack_require__.f.j = (chunkId, promises) => {
+/******/ // import() chunk loading for javascript
+/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
+/******/ if(installedChunkData !== 0) { // 0 means "already installed".
+/******/
+/******/ // a Promise means "currently loading".
+/******/ if(installedChunkData) {
+/******/ promises.push(installedChunkData[1]);
+/******/ } else {
+/******/ if(true) { // all chunks have JS
+/******/ // setup Promise in chunk cache
+/******/ var promise = import("../" + __webpack_require__.u(chunkId)).then(installChunk, (e) => {
+/******/ if(installedChunks[chunkId] !== 0) installedChunks[chunkId] = undefined;
+/******/ throw e;
+/******/ });
+/******/ var promise = Promise.race([promise, new Promise((resolve) => (installedChunkData = installedChunks[chunkId] = [resolve]))])
+/******/ promises.push(installedChunkData[1] = promise);
+/******/ } else installedChunks[chunkId] = 0;
+/******/ }
+/******/ }
+/******/ };
+/******/
+/******/ // no external install chunk
+/******/
+/******/ // no on chunks loaded
+/******/ })();
+/******/
+/************************************************************************/
+```
+
+
+
+``` js
+var __webpack_exports__ = {};
+/*!***********************!*\
+ !*** ./fib-worker.js ***!
+ \***********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: __webpack_require__.e, __webpack_require__, __webpack_require__.* */
+onmessage = async event => {
+ const { fibonacci } = await __webpack_require__.e(/*! import() */ 129).then(__webpack_require__.bind(__webpack_require__, /*! ./fibonacci */ 2));
+ const value = JSON.parse(event.data);
+ postMessage(`fib(${value}) = ${fibonacci(value)}`);
+};
+```
+
+```javascript
+var e,o,r={},t={};function i(e){var o=t[e];if(void 0!==o)return o.exports;var a=t[e]={exports:{}};return r[e](a,a.exports,i),a.exports}i.m=r,i.d=(e,o)=>{for(var r in o)i.o(o,r)&&!i.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:o[r]})},i.f={},i.e=e=>Promise.all(Object.keys(i.f).reduce(((o,r)=>(i.f[r](e,o),o)),[])),i.u=e=>e+".js",i.o=(e,o)=>Object.prototype.hasOwnProperty.call(e,o),i.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},e={631:0},o=o=>{var r,t,{ids:a,modules:n,runtime:s}=o,f=0;for(r in n)i.o(n,r)&&(i.m[r]=n[r]);for(s&&s(i);f{var a=i.o(e,r)?e[r]:void 0;if(0!==a)if(a)t.push(a[1]);else{var n=import("../"+i.u(r)).then(o,(o=>{throw 0!==e[r]&&(e[r]=void 0),o}));n=Promise.race([n,new Promise((o=>a=e[r]=[o]))]),t.push(a[1]=n)}},onmessage=async e=>{const{fibonacci:o}=await i.e(129).then(i.bind(i,129)),r=JSON.parse(e.data);postMessage(`fib(${r}) = ${o(r)}`)};
+```
+
+# dist/129.js
+
+```javascript
+export const id = 129;
+export const ids = [129];
+export const modules = {
+
+/***/ 2:
+/*!**********************!*\
+ !*** ./fibonacci.js ***!
+ \**********************/
+/*! namespace exports */
+/*! export fibonacci [provided] [no usage info] [missing usage info prevents renaming] */
+/*! other exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
+/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
+
+__webpack_require__.r(__webpack_exports__);
+/* harmony export */ __webpack_require__.d(__webpack_exports__, {
+/* harmony export */ "fibonacci": () => (/* binding */ fibonacci)
+/* harmony export */ });
+function fibonacci(n) {
+ return n < 1 ? 0 : n <= 2 ? 1 : fibonacci(n - 1) + fibonacci(n - 2);
+}
+
+
+/***/ })
+
+};
+```
+
+# Info
+
+## Unoptimized
+
+```
+asset main.js 8.56 KiB [emitted] [javascript module] (name: main)
+asset chat.js 6.34 KiB [emitted] [javascript module] (name: chat)
+asset workers/fibonacci.js 5.99 KiB [emitted] [javascript module] (name: fibonacci)
+asset 192.js 1.01 KiB [emitted] [javascript module]
+asset 129.js 847 bytes [emitted] [javascript module]
+chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered]
+ > ./fibonacci ./example.js 70:30-51
+ > ./fibonacci ./fib-worker.js 2:29-50
+ ./fibonacci.js 103 bytes [built] [code generated]
+ [exports: fibonacci]
+ [used exports unknown]
+ import() ./fibonacci ./example.js 70:30-51
+ import() ./fibonacci ./fib-worker.js 2:29-50
+chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 3.07 KiB (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 3.07 KiB 7 modules
+ ./example.js 2.25 KiB [built] [code generated]
+ [used exports unknown]
+ entry ./example.js main
+chunk (runtime: 1fad8bf8de78b0a77bfd) 192.js 152 bytes [rendered]
+ > ./chat-module ./chat-worker.js 11:31-54
+ > ./chat-module ./chat-worker.js 7:27-50
+ ./chat-module.js 152 bytes [built] [code generated]
+ [exports: add, history]
+ [used exports unknown]
+ import() ./chat-module ./chat-worker.js 7:27-50
+ import() ./chat-module ./chat-worker.js 11:31-54
+chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 2.86 KiB (runtime) [entry] [rendered]
+ > ./example.js 25:19-31:1
+ runtime modules 2.86 KiB 6 modules
+ ./chat-worker.js 442 bytes [built] [code generated]
+ [used exports unknown]
+ new Worker() ./chat-worker.js ./example.js 25:19-31:1
+chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.87 KiB (runtime) [entry] [rendered]
+ > ./example.js 80:18-84:2
+ runtime modules 2.87 KiB 6 modules
+ ./fib-worker.js 176 bytes [built] [code generated]
+ [used exports unknown]
+ new Worker() ./fib-worker.js ./example.js 80:18-84:2
+webpack 5.78.0 compiled successfully
+```
+
+## Production mode
+
+```
+asset main.js 2.5 KiB [emitted] [javascript module] [minimized] (name: main)
+asset chat.js 1.19 KiB [emitted] [javascript module] [minimized] (name: chat)
+asset workers/fibonacci.js 1.04 KiB [emitted] [javascript module] [minimized] (name: fibonacci)
+asset 192.js 187 bytes [emitted] [javascript module] [minimized]
+asset 129.js 161 bytes [emitted] [javascript module] [minimized]
+chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered]
+ > ./fibonacci ./example.js 70:30-51
+ > ./fibonacci ./fib-worker.js 2:29-50
+ ./fibonacci.js 103 bytes [built] [code generated]
+ [exports: fibonacci]
+ import() ./fibonacci ./example.js 70:30-51
+ import() ./fibonacci ./fib-worker.js 2:29-50
+chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 3.07 KiB (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 3.07 KiB 7 modules
+ ./example.js 2.25 KiB [built] [code generated]
+ [no exports used]
+ entry ./example.js main
+chunk (runtime: 1fad8bf8de78b0a77bfd) 192.js 152 bytes [rendered]
+ > ./chat-module ./chat-worker.js 11:31-54
+ > ./chat-module ./chat-worker.js 7:27-50
+ ./chat-module.js 152 bytes [built] [code generated]
+ [exports: add, history]
+ import() ./chat-module ./chat-worker.js 7:27-50
+ import() ./chat-module ./chat-worker.js 11:31-54
+chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 442 bytes (javascript) 2.86 KiB (runtime) [entry] [rendered]
+ > ./example.js 25:19-31:1
+ runtime modules 2.86 KiB 6 modules
+ ./chat-worker.js 442 bytes [built] [code generated]
+ [no exports used]
+ new Worker() ./chat-worker.js ./example.js 25:19-31:1
+chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.87 KiB (runtime) [entry] [rendered]
+ > ./example.js 80:18-84:2
+ runtime modules 2.87 KiB 6 modules
+ ./fib-worker.js 176 bytes [built] [code generated]
+ [no exports used]
+ new Worker() ./fib-worker.js ./example.js 80:18-84:2
+webpack 5.78.0 compiled successfully
+```
diff --git a/examples/module-worker/build.js b/examples/module-worker/build.js
new file mode 100644
index 00000000000..5768b058787
--- /dev/null
+++ b/examples/module-worker/build.js
@@ -0,0 +1,3 @@
+global.NO_TARGET_ARGS = true;
+global.NO_PUBLIC_PATH = true;
+require("../build-common");
diff --git a/examples/module-worker/chat-module.js b/examples/module-worker/chat-module.js
new file mode 100644
index 00000000000..716a104a9dc
--- /dev/null
+++ b/examples/module-worker/chat-module.js
@@ -0,0 +1,6 @@
+export const history = [];
+
+export const add = (content, from) => {
+ if (history.length > 10) history.shift();
+ history.push(`${from}: ${content}`);
+};
diff --git a/examples/module-worker/chat-worker.js b/examples/module-worker/chat-worker.js
new file mode 100644
index 00000000000..1a8bcb81ea0
--- /dev/null
+++ b/examples/module-worker/chat-worker.js
@@ -0,0 +1,20 @@
+onconnect = function (e) {
+ for (const port of e.ports) {
+ port.onmessage = async event => {
+ const msg = event.data;
+ switch (msg.type) {
+ case "message":
+ const { add } = await import("./chat-module");
+ add(msg.content, msg.from);
+ // fallthrough
+ case "history":
+ const { history } = await import("./chat-module");
+ port.postMessage({
+ type: "history",
+ history
+ });
+ break;
+ }
+ };
+ }
+};
diff --git a/examples/module-worker/example.js b/examples/module-worker/example.js
new file mode 100644
index 00000000000..fcbe23f092f
--- /dev/null
+++ b/examples/module-worker/example.js
@@ -0,0 +1,97 @@
+document.body.innerHTML = `
+
+
+ Computing fibonacci without worker:
+
+
+ Computing fibonacci with worker:
+
+
+`;
+
+const history = document.getElementById("history");
+const message = document.getElementById("message");
+const send = document.getElementById("send");
+const fib1 = document.getElementById("fib1");
+const output1 = document.getElementById("output1");
+const fib2 = document.getElementById("fib2");
+const output2 = document.getElementById("output2");
+
+/// CHAT with shared worker ///
+
+const chatWorker = new SharedWorker(
+ new URL("./chat-worker.js", import.meta.url),
+ {
+ name: "chat",
+ type: "module"
+ }
+);
+
+let historyTimeout;
+const scheduleUpdateHistory = () => {
+ clearTimeout(historyTimeout);
+ historyTimeout = setTimeout(() => {
+ chatWorker.port.postMessage({ type: "history" });
+ }, 1000);
+};
+scheduleUpdateHistory();
+
+const from = `User ${Math.floor(Math.random() * 10000)}`;
+
+send.addEventListener("click", e => {
+ chatWorker.port.postMessage({
+ type: "message",
+ content: message.value,
+ from
+ });
+ message.value = "";
+ message.focus();
+ e.preventDefault();
+});
+
+chatWorker.port.onmessage = event => {
+ const msg = event.data;
+ switch (msg.type) {
+ case "history":
+ history.innerText = msg.history.join("\n");
+ scheduleUpdateHistory();
+ break;
+ }
+};
+
+/// FIBONACCI without worker ///
+
+fib1.addEventListener("change", async () => {
+ try {
+ const value = parseInt(fib1.value, 10);
+ const { fibonacci } = await import("./fibonacci");
+ const result = fibonacci(value);
+ output1.innerText = `fib(${value}) = ${result}`;
+ } catch (e) {
+ output1.innerText = e.message;
+ }
+});
+
+/// FIBONACCI with worker ///
+
+const fibWorker = new Worker(new URL("./fib-worker.js", import.meta.url), {
+ name: "fibonacci",
+ type: "module"
+ /* webpackEntryOptions: { filename: "workers/[name].js" } */
+});
+
+fib2.addEventListener("change", () => {
+ try {
+ const value = parseInt(fib2.value, 10);
+ fibWorker.postMessage(`${value}`);
+ } catch (e) {
+ output2.innerText = e.message;
+ }
+});
+
+fibWorker.onmessage = event => {
+ output2.innerText = event.data;
+};
diff --git a/examples/module-worker/fib-worker.js b/examples/module-worker/fib-worker.js
new file mode 100644
index 00000000000..42efa83cf4e
--- /dev/null
+++ b/examples/module-worker/fib-worker.js
@@ -0,0 +1,5 @@
+onmessage = async event => {
+ const { fibonacci } = await import("./fibonacci");
+ const value = JSON.parse(event.data);
+ postMessage(`fib(${value}) = ${fibonacci(value)}`);
+};
diff --git a/examples/module-worker/fibonacci.js b/examples/module-worker/fibonacci.js
new file mode 100644
index 00000000000..282fcec2fca
--- /dev/null
+++ b/examples/module-worker/fibonacci.js
@@ -0,0 +1,3 @@
+export function fibonacci(n) {
+ return n < 1 ? 0 : n <= 2 ? 1 : fibonacci(n - 1) + fibonacci(n - 2);
+}
diff --git a/examples/module-worker/index.html b/examples/module-worker/index.html
new file mode 100644
index 00000000000..e3b460bdf15
--- /dev/null
+++ b/examples/module-worker/index.html
@@ -0,0 +1,10 @@
+
+
+
+
+ Worker example
+
+
+
+
+
diff --git a/examples/module-worker/template.md b/examples/module-worker/template.md
new file mode 100644
index 00000000000..6a93ddfd9b5
--- /dev/null
+++ b/examples/module-worker/template.md
@@ -0,0 +1,75 @@
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# fib-worker.js
+
+```javascript
+_{{fib-worker.js}}_
+```
+
+# fibonacci.js
+
+```javascript
+_{{fibonacci.js}}_
+```
+
+# chat-worker.js
+
+```javascript
+_{{chat-worker.js}}_
+```
+
+# chat-module.js
+
+```javascript
+_{{chat-module.js}}_
+```
+
+# dist/main.js
+
+```javascript
+_{{dist/main.js}}_
+```
+
+# dist/chat.js
+
+```javascript
+_{{dist/chat.js}}_
+```
+
+```javascript
+_{{production:dist/chat.js}}_
+```
+
+# dist/workers/fibonacci.js
+
+```javascript
+_{{dist/workers/fibonacci.js}}_
+```
+
+```javascript
+_{{production:dist/workers/fibonacci.js}}_
+```
+
+# dist/129.js
+
+```javascript
+_{{dist/129.js}}_
+```
+
+# Info
+
+## Unoptimized
+
+```
+_{{stdout}}_
+```
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/module-worker/webpack.config.js b/examples/module-worker/webpack.config.js
new file mode 100644
index 00000000000..7787a5113be
--- /dev/null
+++ b/examples/module-worker/webpack.config.js
@@ -0,0 +1,18 @@
+const path = require("path");
+
+module.exports = {
+ entry: "./example.js",
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "[name].js",
+ chunkFilename: "[name].js",
+ publicPath: "/dist/"
+ },
+ optimization: {
+ chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
+ },
+ target: "browserslist: last 2 Chrome versions",
+ experiments: {
+ outputModule: true
+ }
+};
diff --git a/examples/module/README.md b/examples/module/README.md
index 1070ace1342..4f366c2fb6d 100644
--- a/examples/module/README.md
+++ b/examples/module/README.md
@@ -40,7 +40,6 @@ export function reset() {
# dist/output.js
```javascript
-/******/ "use strict";
/******/ // The require scope
/******/ var __webpack_require__ = {};
/******/
@@ -134,7 +133,7 @@ var e={d:(o,r)=>{for(var t in r)e.o(r,t)&&!e.o(o,t)&&Object.defineProperty(o,t,{
## Unoptimized
```
-asset output.js 2.05 KiB [emitted] [javascript module] (name: main)
+asset output.js 2.03 KiB [emitted] [javascript module] (name: main)
chunk (runtime: main) output.js (main) 453 bytes (javascript) 396 bytes (runtime) [entry] [rendered]
> ./example.js main
runtime modules 396 bytes 2 modules
@@ -143,7 +142,7 @@ chunk (runtime: main) output.js (main) 453 bytes (javascript) 396 bytes (runtime
[all exports used]
entry ./example.js main
used as library export
-webpack 5.20.2 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -158,5 +157,5 @@ chunk (runtime: main) output.js (main) 453 bytes (javascript) 396 bytes (runtime
[all exports used]
entry ./example.js main
used as library export
-webpack 5.20.2 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/multi-compiler/README.md b/examples/multi-compiler/README.md
index 3c87432245e..e781ad0894f 100644
--- a/examples/multi-compiler/README.md
+++ b/examples/multi-compiler/README.md
@@ -15,7 +15,7 @@ var webpack = require("../../");
module.exports = [
{
name: "mobile",
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: "./example",
output: {
path: path.join(__dirname, "dist"),
@@ -30,7 +30,7 @@ module.exports = [
{
name: "desktop",
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: "./example",
output: {
path: path.join(__dirname, "dist"),
@@ -49,6 +49,7 @@ module.exports = [
```javascript
/******/ (() => { // webpackBootstrap
+var __webpack_exports__ = {};
/*!********************!*\
!*** ./example.js ***!
\********************/
@@ -90,8 +91,9 @@ console.log("Running " + "desktop" + " build");
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -113,6 +115,8 @@ console.log("Running " + "desktop" + " build");
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -135,37 +139,37 @@ console.log("Running " + "mobile" + " build");
```
mobile:
- asset mobile.js 1.57 KiB [emitted] (name: main)
+ asset mobile.js 1.74 KiB [emitted] (name: main)
chunk (runtime: main) mobile.js (main) 114 bytes [entry] [rendered]
> ./example main
dependent modules 20 bytes [dependent] 1 module
./example.js 94 bytes [built] [code generated]
[used exports unknown]
entry ./example main
- mobile (webpack 5.11.1) compiled successfully
+ mobile (webpack 5.78.0) compiled successfully
desktop:
- asset desktop.js 262 bytes [emitted] (name: main)
+ asset desktop.js 292 bytes [emitted] (name: main)
chunk (runtime: main) desktop.js (main) 94 bytes [entry] [rendered]
> ./example main
./example.js 94 bytes [built] [code generated]
[used exports unknown]
entry ./example main
- desktop (webpack 5.11.1) compiled successfully
+ desktop (webpack 5.78.0) compiled successfully
```
## Production mode
```
mobile:
- asset mobile.js 181 bytes [emitted] [minimized] (name: main)
+ asset mobile.js 195 bytes [emitted] [minimized] (name: main)
chunk (runtime: main) mobile.js (main) 114 bytes [entry] [rendered]
> ./example main
dependent modules 20 bytes [dependent] 1 module
./example.js 94 bytes [built] [code generated]
[no exports used]
entry ./example main
- mobile (webpack 5.11.1) compiled successfully
+ mobile (webpack 5.78.0) compiled successfully
desktop:
asset desktop.js 37 bytes [emitted] [minimized] (name: main)
@@ -174,5 +178,5 @@ desktop:
./example.js 94 bytes [built] [code generated]
[no exports used]
entry ./example main
- desktop (webpack 5.11.1) compiled successfully
+ desktop (webpack 5.78.0) compiled successfully
```
diff --git a/examples/multi-compiler/webpack.config.js b/examples/multi-compiler/webpack.config.js
index 4fc3088639a..e7b01428c58 100644
--- a/examples/multi-compiler/webpack.config.js
+++ b/examples/multi-compiler/webpack.config.js
@@ -1,9 +1,10 @@
-var path = require("path");
-var webpack = require("../../");
+const path = require("path");
+const webpack = require("../../");
+
module.exports = [
{
name: "mobile",
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: "./example",
output: {
path: path.join(__dirname, "dist"),
@@ -18,7 +19,7 @@ module.exports = [
{
name: "desktop",
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: "./example",
output: {
path: path.join(__dirname, "dist"),
diff --git a/examples/multi-part-library/README.md b/examples/multi-part-library/README.md
index cd49bab36d9..d1e6870efb0 100644
--- a/examples/multi-part-library/README.md
+++ b/examples/multi-part-library/README.md
@@ -10,14 +10,14 @@ You can see that webpack automatically wraps your module so that it is consumabl
Note: You can also use the `library` and `libraryTarget` options without multiple entry points. Then you don't need `[name]`.
-Note: When your library has dependencies that should not be included in the compiled version, you can use the `externals` option. See [externals example](https://github.com/webpack/webpack/tree/master/examples/externals).
+Note: When your library has dependencies that should not be included in the compiled version, you can use the `externals` option. See [externals example](https://github.com/webpack/webpack/tree/main/examples/externals).
# webpack.config.js
```javascript
var path = require("path");
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
alpha: "./alpha",
beta: "./beta"
@@ -43,7 +43,7 @@ module.exports = {
exports["MyLibrary"] = factory();
else
root["MyLibrary"] = root["MyLibrary"] || {}, root["MyLibrary"]["alpha"] = factory();
-})(self, function() {
+})(self, () => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ([
/* 0 */
@@ -71,8 +71,9 @@ module.exports = "alpha";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -94,10 +95,13 @@ module.exports = "alpha";
``` js
-/******/ // module exports must be returned from runtime so entry inlining is disabled
+/******/
/******/ // startup
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(0);
+/******/ // This entry module is referenced by other modules so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/
+/******/ return __webpack_exports__;
/******/ })()
;
});
@@ -115,7 +119,7 @@ module.exports = "alpha";
exports["MyLibrary"] = factory();
else
root["MyLibrary"] = root["MyLibrary"] || {}, root["MyLibrary"]["beta"] = factory();
-})(self, function() {
+})(self, () => {
return /******/ (() => { // webpackBootstrap
/******/ var __webpack_modules__ = ([
/* 0 */,
@@ -144,8 +148,9 @@ module.exports = "beta";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -167,10 +172,13 @@ module.exports = "beta";
``` js
-/******/ // module exports must be returned from runtime so entry inlining is disabled
+/******/
/******/ // startup
/******/ // Load entry module and return exports
-/******/ return __webpack_require__(1);
+/******/ // This entry module is referenced by other modules so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(1);
+/******/
+/******/ return __webpack_exports__;
/******/ })()
;
});
@@ -181,8 +189,8 @@ module.exports = "beta";
## Unoptimized
```
-asset MyLibrary.beta.js 1.96 KiB [emitted] (name: beta)
-asset MyLibrary.alpha.js 1.95 KiB [emitted] (name: alpha)
+asset MyLibrary.beta.js 2.06 KiB [emitted] (name: beta)
+asset MyLibrary.alpha.js 2.06 KiB [emitted] (name: alpha)
chunk (runtime: alpha) MyLibrary.alpha.js (alpha) 25 bytes [entry] [rendered]
> ./alpha alpha
./alpha.js 25 bytes [built] [code generated]
@@ -197,14 +205,14 @@ chunk (runtime: beta) MyLibrary.beta.js (beta) 24 bytes [entry] [rendered]
cjs self exports reference ./beta.js 1:0-14
entry ./beta beta
used as library export
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset MyLibrary.alpha.js 415 bytes [emitted] [minimized] (name: alpha)
-asset MyLibrary.beta.js 411 bytes [emitted] [minimized] (name: beta)
+asset MyLibrary.alpha.js 423 bytes [emitted] [minimized] (name: alpha)
+asset MyLibrary.beta.js 419 bytes [emitted] [minimized] (name: beta)
chunk (runtime: alpha) MyLibrary.alpha.js (alpha) 25 bytes [entry] [rendered]
> ./alpha alpha
./alpha.js 25 bytes [built] [code generated]
@@ -219,5 +227,5 @@ chunk (runtime: beta) MyLibrary.beta.js (beta) 24 bytes [entry] [rendered]
cjs self exports reference ./beta.js 1:0-14
entry ./beta beta
used as library export
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/multi-part-library/template.md b/examples/multi-part-library/template.md
index f1083c20440..6237b338ecb 100644
--- a/examples/multi-part-library/template.md
+++ b/examples/multi-part-library/template.md
@@ -10,7 +10,7 @@ You can see that webpack automatically wraps your module so that it is consumabl
Note: You can also use the `library` and `libraryTarget` options without multiple entry points. Then you don't need `[name]`.
-Note: When your library has dependencies that should not be included in the compiled version, you can use the `externals` option. See [externals example](https://github.com/webpack/webpack/tree/master/examples/externals).
+Note: When your library has dependencies that should not be included in the compiled version, you can use the `externals` option. See [externals example](https://github.com/webpack/webpack/tree/main/examples/externals).
# webpack.config.js
diff --git a/examples/multi-part-library/webpack.config.js b/examples/multi-part-library/webpack.config.js
index f79be11fe71..2d829643bcc 100644
--- a/examples/multi-part-library/webpack.config.js
+++ b/examples/multi-part-library/webpack.config.js
@@ -1,6 +1,7 @@
-var path = require("path");
+const path = require("path");
+
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
alpha: "./alpha",
beta: "./beta"
diff --git a/examples/multiple-entry-points/README.md b/examples/multiple-entry-points/README.md
index 2cc3461ee83..3378e9c728c 100644
--- a/examples/multiple-entry-points/README.md
+++ b/examples/multiple-entry-points/README.md
@@ -51,7 +51,7 @@ require.ensure(["./shared"], function(require) {
```javascript
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
pageA: "./pageA",
pageB: "./pageB"
@@ -120,7 +120,7 @@ module.exports = "Common";
var common = __webpack_require__(/*! ./common */ 1);
__webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD_REQUIRE_ARRAY__ = [__webpack_require__(/*! ./shared */ 3)]; (function(shared) {
shared("This is page A");
-}).apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);}).catch(__webpack_require__.oe);
+}).apply(null, __WEBPACK_AMD_REQUIRE_ARRAY__);})['catch'](__webpack_require__.oe);
/***/ })
/******/ ]);
@@ -136,8 +136,9 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -156,10 +157,39 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
@@ -184,7 +214,7 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -192,7 +222,7 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -222,10 +252,9 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -244,14 +273,11 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 424: 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/ [0,351]
-/******/ ];
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -263,9 +289,7 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -287,7 +311,7 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -301,69 +325,36 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -372,8 +363,13 @@ __webpack_require__.e(/*! AMD require */ 52).then(function() { var __WEBPACK_AMD
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module depends on other loaded chunks and execution need to be delayed
+/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [351], () => (__webpack_require__(0)))
+/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
+/******/
/******/ })()
;
```
@@ -396,7 +392,7 @@ var common = __webpack_require__(/*! ./common */ 1);
__webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
var shared = __webpack_require__(/*! ./shared */ 3);
shared("This is page B");
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
/***/ })
@@ -413,8 +409,9 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -433,10 +430,39 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = __webpack_modules__;
/******/
-/******/ // the startup function
-/******/ // It's empty as some runtime module handles the default behavior
-/******/ __webpack_require__.x = x => {}
/************************************************************************/
+/******/ /* webpack/runtime/chunk loaded */
+/******/ (() => {
+/******/ var deferred = [];
+/******/ __webpack_require__.O = (result, chunkIds, fn, priority) => {
+/******/ if(chunkIds) {
+/******/ priority = priority || 0;
+/******/ for(var i = deferred.length; i > 0 && deferred[i - 1][2] > priority; i--) deferred[i] = deferred[i - 1];
+/******/ deferred[i] = [chunkIds, fn, priority];
+/******/ return;
+/******/ }
+/******/ var notFulfilled = Infinity;
+/******/ for (var i = 0; i < deferred.length; i++) {
+/******/ var [chunkIds, fn, priority] = deferred[i];
+/******/ var fulfilled = true;
+/******/ for (var j = 0; j < chunkIds.length; j++) {
+/******/ if ((priority & 1 === 0 || notFulfilled >= priority) && Object.keys(__webpack_require__.O).every((key) => (__webpack_require__.O[key](chunkIds[j])))) {
+/******/ chunkIds.splice(j--, 1);
+/******/ } else {
+/******/ fulfilled = false;
+/******/ if(priority < notFulfilled) notFulfilled = priority;
+/******/ }
+/******/ }
+/******/ if(fulfilled) {
+/******/ deferred.splice(i--, 1)
+/******/ var r = fn();
+/******/ if (r !== undefined) result = r;
+/******/ }
+/******/ }
+/******/ return result;
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/ensure chunk */
/******/ (() => {
/******/ __webpack_require__.f = {};
@@ -461,7 +487,7 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -469,7 +495,7 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -499,10 +525,9 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -521,14 +546,11 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 121: 0
/******/ };
/******/
-/******/ var deferredModules = [
-/******/ [2,351]
-/******/ ];
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -540,9 +562,7 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -564,7 +584,7 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -578,69 +598,36 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
/******/
/******/ // no HMR manifest
/******/
-/******/ var checkDeferredModules = x => {};
+/******/ __webpack_require__.O.j = (chunkId) => (installedChunks[chunkId] === 0);
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
-/******/ var [chunkIds, moreModules, runtime, executeModules] = data;
+/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
-/******/
-/******/ // add entry modules from loaded chunk to deferred list
-/******/ if(executeModules) deferredModules.push.apply(deferredModules, executeModules);
-/******/
-/******/ // run deferred modules when all chunks ready
-/******/ return checkDeferredModules();
+/******/ return __webpack_require__.O(result);
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ function checkDeferredModulesImpl() {
-/******/ var result;
-/******/ for(var i = 0; i < deferredModules.length; i++) {
-/******/ var deferredModule = deferredModules[i];
-/******/ var fulfilled = true;
-/******/ for(var j = 1; j < deferredModule.length; j++) {
-/******/ var depId = deferredModule[j];
-/******/ if(installedChunks[depId] !== 0) fulfilled = false;
-/******/ }
-/******/ if(fulfilled) {
-/******/ deferredModules.splice(i--, 1);
-/******/ result = __webpack_require__(__webpack_require__.s = deferredModule[0]);
-/******/ }
-/******/ }
-/******/ if(deferredModules.length === 0) {
-/******/ __webpack_require__.x();
-/******/ __webpack_require__.x = x => {};
-/******/ }
-/******/ return result;
-/******/ }
-/******/ var startup = __webpack_require__.x;
-/******/ __webpack_require__.x = () => {
-/******/ // reset startup function so it can be called again when more startup code is added
-/******/ __webpack_require__.x = startup || (x => {});
-/******/ return (checkDeferredModules = checkDeferredModulesImpl)();
-/******/ };
/******/ })();
/******/
/************************************************************************/
@@ -649,8 +636,13 @@ __webpack_require__.e(/*! require.ensure */ 52).then((function(require) {
``` js
-/******/ // run startup
-/******/ return __webpack_require__.x();
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module depends on other loaded chunks and execution need to be delayed
+/******/ var __webpack_exports__ = __webpack_require__.O(undefined, [351], () => (__webpack_require__(2)))
+/******/ __webpack_exports__ = __webpack_require__.O(__webpack_exports__);
+/******/
/******/ })()
;
```
@@ -685,23 +677,24 @@ module.exports = function(msg) {
```
asset pageA.js 10.7 KiB [emitted] (name: pageA)
-asset pageB.js 10.6 KiB [emitted] (name: pageB)
+asset pageB.js 10.7 KiB [emitted] (name: pageB)
asset 52.js 506 bytes [emitted]
asset commons.js 364 bytes [emitted] (name: commons) (id hint: commons)
-Entrypoint pageA 11 KiB = commons.js 364 bytes pageA.js 10.7 KiB
-Entrypoint pageB 11 KiB = commons.js 364 bytes pageB.js 10.6 KiB
+Entrypoint pageA 11.1 KiB = commons.js 364 bytes pageA.js 10.7 KiB
+Entrypoint pageB 11 KiB = commons.js 364 bytes pageB.js 10.7 KiB
chunk (runtime: pageA, pageB) 52.js 88 bytes [rendered]
> ./shared ./pageA.js 2:0-4:2
> ./pageB.js 2:0-5:2
./shared.js 88 bytes [built] [code generated]
[used exports unknown]
+ from origin ./pageB.js
+ require.ensure item ./shared ./pageB.js 2:0-5:2
+ cjs require ./shared ./pageB.js 3:14-33
amd require ./shared ./pageA.js 2:0-4:2
- require.ensure item ./shared ./pageB.js 2:0-5:2
- cjs require ./shared ./pageB.js 3:14-33
cjs self exports reference ./shared.js 2:0-14
-chunk (runtime: pageB) pageB.js (pageB) 148 bytes (javascript) 6.03 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageB) pageB.js (pageB) 148 bytes (javascript) 5.91 KiB (runtime) [entry] [rendered]
> ./pageB pageB
- runtime modules 6.03 KiB 6 modules
+ runtime modules 5.91 KiB 7 modules
./pageB.js 148 bytes [built] [code generated]
[used exports unknown]
entry ./pageB pageB
@@ -714,36 +707,37 @@ chunk (runtime: pageA, pageB) commons.js (commons) (id hint: commons) 26 bytes [
cjs require ./common ./pageA.js 1:13-32
cjs require ./common ./pageB.js 1:13-32
cjs require ./common ./shared.js 1:13-32
-chunk (runtime: pageA) pageA.js (pageA) 105 bytes (javascript) 6.03 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageA) pageA.js (pageA) 105 bytes (javascript) 5.91 KiB (runtime) [entry] [rendered]
> ./pageA pageA
- runtime modules 6.03 KiB 6 modules
+ runtime modules 5.91 KiB 7 modules
./pageA.js 105 bytes [built] [code generated]
[used exports unknown]
entry ./pageA pageA
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset pageA.js 2.04 KiB [emitted] [minimized] (name: pageA)
-asset pageB.js 2.01 KiB [emitted] [minimized] (name: pageB)
+asset pageA.js 2.16 KiB [emitted] [minimized] (name: pageA)
+asset pageB.js 2.13 KiB [emitted] [minimized] (name: pageB)
asset 52.js 116 bytes [emitted] [minimized]
asset commons.js 86 bytes [emitted] [minimized] (name: commons) (id hint: commons)
-Entrypoint pageA 2.12 KiB = commons.js 86 bytes pageA.js 2.04 KiB
-Entrypoint pageB 2.1 KiB = commons.js 86 bytes pageB.js 2.01 KiB
+Entrypoint pageA 2.24 KiB = commons.js 86 bytes pageA.js 2.16 KiB
+Entrypoint pageB 2.21 KiB = commons.js 86 bytes pageB.js 2.13 KiB
chunk (runtime: pageA, pageB) 52.js 88 bytes [rendered]
> ./shared ./pageA.js 2:0-4:2
> ./pageB.js 2:0-5:2
./shared.js 88 bytes [built] [code generated]
[used exports unknown]
+ from origin ./pageB.js
+ require.ensure item ./shared ./pageB.js 2:0-5:2
+ cjs require ./shared ./pageB.js 3:14-33
amd require ./shared ./pageA.js 2:0-4:2
- require.ensure item ./shared ./pageB.js 2:0-5:2
- cjs require ./shared ./pageB.js 3:14-33
cjs self exports reference ./shared.js 2:0-14
-chunk (runtime: pageB) pageB.js (pageB) 148 bytes (javascript) 6.03 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageB) pageB.js (pageB) 148 bytes (javascript) 5.91 KiB (runtime) [entry] [rendered]
> ./pageB pageB
- runtime modules 6.03 KiB 6 modules
+ runtime modules 5.91 KiB 7 modules
./pageB.js 148 bytes [built] [code generated]
[no exports used]
entry ./pageB pageB
@@ -756,11 +750,11 @@ chunk (runtime: pageA, pageB) commons.js (commons) (id hint: commons) 26 bytes [
cjs require ./common ./pageA.js 1:13-32
cjs require ./common ./pageB.js 1:13-32
cjs require ./common ./shared.js 1:13-32
-chunk (runtime: pageA) pageA.js (pageA) 105 bytes (javascript) 6.03 KiB (runtime) [entry] [rendered]
+chunk (runtime: pageA) pageA.js (pageA) 105 bytes (javascript) 5.91 KiB (runtime) [entry] [rendered]
> ./pageA pageA
- runtime modules 6.03 KiB 6 modules
+ runtime modules 5.91 KiB 7 modules
./pageA.js 105 bytes [built] [code generated]
[no exports used]
entry ./pageA pageA
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/multiple-entry-points/webpack.config.js b/examples/multiple-entry-points/webpack.config.js
index 4df8e07d565..a4fdc01c909 100644
--- a/examples/multiple-entry-points/webpack.config.js
+++ b/examples/multiple-entry-points/webpack.config.js
@@ -1,5 +1,5 @@
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
pageA: "./pageA",
pageB: "./pageB"
diff --git a/examples/named-chunks/README.md b/examples/named-chunks/README.md
index f0b41b963fd..f2410692722 100644
--- a/examples/named-chunks/README.md
+++ b/examples/named-chunks/README.md
@@ -53,8 +53,9 @@ require.ensure(["b"], function(require) {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -98,7 +99,7 @@ require.ensure(["b"], function(require) {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -106,7 +107,7 @@ require.ensure(["b"], function(require) {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -136,10 +137,9 @@ require.ensure(["b"], function(require) {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -158,12 +158,11 @@ require.ensure(["b"], function(require) {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -175,9 +174,7 @@ require.ensure(["b"], function(require) {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -199,7 +196,7 @@ require.ensure(["b"], function(require) {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -213,39 +210,36 @@ require.ensure(["b"], function(require) {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -254,6 +248,8 @@ require.ensure(["b"], function(require) {
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -265,21 +261,21 @@ var a = __webpack_require__(/*! a */ 1);
__webpack_require__.e(/*! require.ensure | my own chunk */ 666).then((function(require) {
// a named chunk
var c = __webpack_require__(/*! c */ 3);
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
__webpack_require__.e(/*! require.ensure | my own chunk */ 666).then((function(require) {
// another chunk with the same name
var d = __webpack_require__(/*! d */ 4);
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
__webpack_require__.e(/*! require.ensure | my own chunk */ 666).then((function(require) {
// the same again
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
__webpack_require__.e(/*! require.ensure */ 885).then((function(require) {
// chunk without name
var d = __webpack_require__(/*! d */ 4);
-}).bind(null, __webpack_require__)).catch(__webpack_require__.oe);
+}).bind(null, __webpack_require__))['catch'](__webpack_require__.oe);
})();
@@ -366,7 +362,7 @@ __webpack_require__.e(/*! require.ensure */ 885).then((function(require) {
## Unoptimized
```
-asset output.js 9.72 KiB [emitted] (name: main)
+asset output.js 9.83 KiB [emitted] (name: main)
asset 666.output.js 735 bytes [emitted] (name: my own chunk)
asset 885.output.js 528 bytes [emitted]
chunk (runtime: main) output.js (main) 432 bytes (javascript) 4.97 KiB (runtime) [entry] [rendered]
@@ -403,7 +399,7 @@ chunk (runtime: main) 885.output.js 22 bytes [rendered]
[used exports unknown]
cjs require d ./example.js 10:9-21
cjs require d ./example.js 19:9-21
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -446,5 +442,5 @@ chunk (runtime: main) 885.output.js 22 bytes [rendered]
[used exports unknown]
cjs require d ./example.js 10:9-21
cjs require d ./example.js 19:9-21
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/node_modules/module.js b/examples/node_modules/module.js
index f23403c2c0f..d6df8480e22 100644
--- a/examples/node_modules/module.js
+++ b/examples/node_modules/module.js
@@ -1 +1 @@
-module.exports = "module";
\ No newline at end of file
+module.exports = "module";
diff --git a/examples/persistent-caching/README.md b/examples/persistent-caching/README.md
index c7ba3a570b6..f8dd47f36b6 100644
--- a/examples/persistent-caching/README.md
+++ b/examples/persistent-caching/README.md
@@ -55,34 +55,34 @@ module.exports = (env = "development") => ({
## Unoptimized
```
-asset output.js 3.99 MiB [emitted] (name: main)
-chunk (runtime: main) output.js (main) 2.86 MiB (javascript) 1.58 KiB (runtime) [entry]
+asset output.js 4.52 MiB [emitted] (name: main)
+chunk (runtime: main) output.js (main) 3.26 MiB (javascript) 1.29 KiB (runtime) [entry]
> ./example.js main
- cached modules 2.86 MiB (javascript) 1.58 KiB (runtime) [cached] 1210 modules
-webpack 5.11.1 compiled successfully
+ cached modules 3.26 MiB (javascript) 1.29 KiB (runtime) [cached] 1415 modules
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 551 KiB [emitted] [minimized] [big] (name: main) 1 related asset
-chunk (runtime: main) output.js (main) 1.91 MiB (javascript) 1.58 KiB (runtime) [entry]
+asset output.js 630 KiB [emitted] [minimized] [big] (name: main) 1 related asset
+chunk (runtime: main) output.js (main) 2.18 MiB (javascript) 1.29 KiB (runtime) [entry]
> ./example.js main
- cached modules 1.91 MiB (javascript) 1.58 KiB (runtime) [cached] 591 modules
+ cached modules 2.18 MiB (javascript) 1.29 KiB (runtime) [cached] 791 modules
WARNING in asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets:
- output.js (551 KiB)
+ output.js (630 KiB)
WARNING in entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
- main (551 KiB)
+ main (630 KiB)
output.js
WARNING in webpack performance recommendations:
You can limit the size of your bundles by using import() or require.ensure to lazy load some parts of your application.
For more info visit https://webpack.js.org/guides/code-splitting/
-webpack 5.11.1 compiled with 3 warnings
+webpack 5.78.0 compiled with 3 warnings
```
diff --git a/examples/reexport-components/README.md b/examples/reexport-components/README.md
index 0668a0b8538..6664b1ec603 100644
--- a/examples/reexport-components/README.md
+++ b/examples/reexport-components/README.md
@@ -49,6 +49,7 @@ export { DialogInline } from "./DialogInline";
# dist/pages_Dashboard_js.output.js
```javascript
+"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([["pages_Dashboard_js"],{
/***/ "./components/Button.js":
@@ -60,16 +61,14 @@ export { DialogInline } from "./DialogInline";
/*! runtime requirements: __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": () => /* binding */ Button
+/* harmony export */ "default": () => (/* binding */ Button)
/* harmony export */ });
const Button = () => {
return /*#__PURE__*/React.createElement("button", null);
};
-
/***/ }),
/***/ "./components/Checkbox.js":
@@ -81,9 +80,8 @@ const Button = () => {
/*! runtime requirements: __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "Checkbox": () => /* binding */ Checkbox
+/* harmony export */ "Checkbox": () => (/* binding */ Checkbox)
/* harmony export */ });
const Checkbox = () => {
return /*#__PURE__*/React.createElement("input", {
@@ -92,7 +90,6 @@ const Checkbox = () => {
};
-
/***/ }),
/***/ "./pages/Dashboard.js":
@@ -105,19 +102,16 @@ const Checkbox = () => {
/*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.r, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__
+/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components */ "./components/Button.js");
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components */ "./components/Checkbox.js");
-
const Dashboard = () => {
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_0__.default, null), /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_1__.Checkbox, null));
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_0__["default"], null), /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_1__.Checkbox, null));
};
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Dashboard);
/***/ })
@@ -128,6 +122,7 @@ const Dashboard = () => {
# dist/pages_Login_js.output.js
```javascript
+"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([["pages_Login_js"],{
/***/ "./components/Button.js":
@@ -139,16 +134,14 @@ const Dashboard = () => {
/*! runtime requirements: __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": () => /* binding */ Button
+/* harmony export */ "default": () => (/* binding */ Button)
/* harmony export */ });
const Button = () => {
return /*#__PURE__*/React.createElement("button", null);
};
-
/***/ }),
/***/ "./components/Dialog.js":
@@ -160,16 +153,14 @@ const Button = () => {
/*! runtime requirements: __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__
+/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
const Dialog = ({
children
}) => {
return /*#__PURE__*/React.createElement("dialog", null, children);
};
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Dialog);
/***/ }),
@@ -184,19 +175,16 @@ const Dialog = ({
/*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.r, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "default": () => __WEBPACK_DEFAULT_EXPORT__
+/* harmony export */ "default": () => (__WEBPACK_DEFAULT_EXPORT__)
/* harmony export */ });
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../components */ "./components/Button.js");
/* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../components */ "./components/Dialog.js");
-
const Login = () => {
- return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_0__.default, null), /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_1__.default, null));
+ return /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_0__["default"], null), /*#__PURE__*/React.createElement(_components__WEBPACK_IMPORTED_MODULE_1__["default"], null));
};
-
/* harmony default export */ const __WEBPACK_DEFAULT_EXPORT__ = (Login);
/***/ })
@@ -205,7 +193,7 @@ const Login = () => {
```
```javascript
-(self.webpackChunk=self.webpackChunk||[]).push([["pages_Login_js"],{"./components/Button.js":(e,t,n)=>{"use strict";n.d(t,{Z:()=>c});const c=()=>React.createElement("button",null)},"./pages/Login.js":(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>a});const c=({children:e})=>React.createElement("dialog",null,e);var l=n("./components/Button.js");const a=()=>React.createElement(React.Fragment,null,React.createElement(l.Z,null),React.createElement(c,null))}}]);
+"use strict";(self.webpackChunk=self.webpackChunk||[]).push([["pages_Login_js"],{"./components/Button.js":(e,t,n)=>{n.d(t,{Z:()=>l});const l=()=>React.createElement("button",null)},"./pages/Login.js":(e,t,n)=>{n.r(t),n.d(t,{default:()=>c});var l=n("./components/Button.js");const a=({children:e})=>React.createElement("dialog",null,e),c=()=>React.createElement(React.Fragment,null,React.createElement(l.Z,null),React.createElement(a,null))}}]);
```
# Info
@@ -213,9 +201,9 @@ const Login = () => {
## Unoptimized
```
-asset output.js 10.9 KiB [emitted] (name: main)
-asset pages_Login_js.output.js 2.84 KiB [emitted]
-asset pages_Dashboard_js.output.js 2.8 KiB [emitted]
+asset output.js 11 KiB [emitted] (name: main)
+asset pages_Login_js.output.js 2.82 KiB [emitted]
+asset pages_Dashboard_js.output.js 2.78 KiB [emitted]
chunk (runtime: main) output.js (main) 208 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.54 KiB 8 modules
@@ -223,31 +211,31 @@ chunk (runtime: main) output.js (main) 208 bytes (javascript) 5.54 KiB (runtime)
./example.js 48 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-chunk (runtime: main) pages_Dashboard_js.output.js 513 bytes [rendered]
+chunk (runtime: main) pages_Dashboard_js.output.js 509 bytes [rendered]
> ./Dashboard ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard
> ./Dashboard.js ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard.js
- dependent modules 244 bytes [dependent] 2 modules
- ./pages/Dashboard.js 269 bytes [optional] [built] [code generated]
+ dependent modules 242 bytes [dependent] 2 modules
+ ./pages/Dashboard.js 267 bytes [optional] [built] [code generated]
[exports: default]
- context element ./Dashboard ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard
- context element ./Dashboard.js ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard.js
-chunk (runtime: main) pages_Login_js.output.js 504 bytes [rendered]
+ import() context element ./Dashboard ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard
+ import() context element ./Dashboard.js ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard.js
+chunk (runtime: main) pages_Login_js.output.js 500 bytes [rendered]
> ./Login ./pages/ lazy ^\.\/.*$ namespace object ./Login
> ./Login.js ./pages/ lazy ^\.\/.*$ namespace object ./Login.js
- dependent modules 247 bytes [dependent] 2 modules
- ./pages/Login.js 257 bytes [optional] [built] [code generated]
+ dependent modules 245 bytes [dependent] 2 modules
+ ./pages/Login.js 255 bytes [optional] [built] [code generated]
[exports: default]
- context element ./Login ./pages/ lazy ^\.\/.*$ namespace object ./Login
- context element ./Login.js ./pages/ lazy ^\.\/.*$ namespace object ./Login.js
-webpack 5.11.1 compiled successfully
+ import() context element ./Login ./pages/ lazy ^\.\/.*$ namespace object ./Login
+ import() context element ./Login.js ./pages/ lazy ^\.\/.*$ namespace object ./Login.js
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 2.48 KiB [emitted] [minimized] (name: main)
-asset pages_Dashboard_js.output.js 469 bytes [emitted] [minimized]
-asset pages_Login_js.output.js 463 bytes [emitted] [minimized]
+asset output.js 2.49 KiB [emitted] [minimized] (name: main)
+asset pages_Dashboard_js.output.js 450 bytes [emitted] [minimized]
+asset pages_Login_js.output.js 444 bytes [emitted] [minimized]
chunk (runtime: main) output.js (main) 208 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.54 KiB 8 modules
@@ -255,21 +243,21 @@ chunk (runtime: main) output.js (main) 208 bytes (javascript) 5.54 KiB (runtime)
./example.js 48 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-chunk (runtime: main) pages_Dashboard_js.output.js 513 bytes [rendered]
+chunk (runtime: main) pages_Dashboard_js.output.js 509 bytes [rendered]
> ./Dashboard ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard
> ./Dashboard.js ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard.js
- dependent modules 115 bytes [dependent] 1 module
- ./pages/Dashboard.js + 1 modules 398 bytes [optional] [built] [code generated]
+ dependent modules 114 bytes [dependent] 1 module
+ ./pages/Dashboard.js + 1 modules 395 bytes [optional] [built] [code generated]
[exports: default]
- context element ./Dashboard ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard
- context element ./Dashboard.js ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard.js
-chunk (runtime: main) pages_Login_js.output.js 504 bytes [rendered]
+ import() context element ./Dashboard ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard
+ import() context element ./Dashboard.js ./pages/ lazy ^\.\/.*$ namespace object ./Dashboard.js
+chunk (runtime: main) pages_Login_js.output.js 500 bytes [rendered]
> ./Login ./pages/ lazy ^\.\/.*$ namespace object ./Login
> ./Login.js ./pages/ lazy ^\.\/.*$ namespace object ./Login.js
- dependent modules 115 bytes [dependent] 1 module
- ./pages/Login.js + 1 modules 389 bytes [optional] [built] [code generated]
+ dependent modules 114 bytes [dependent] 1 module
+ ./pages/Login.js + 1 modules 386 bytes [optional] [built] [code generated]
[exports: default]
- context element ./Login ./pages/ lazy ^\.\/.*$ namespace object ./Login
- context element ./Login.js ./pages/ lazy ^\.\/.*$ namespace object ./Login.js
-webpack 5.11.1 compiled successfully
+ import() context element ./Login ./pages/ lazy ^\.\/.*$ namespace object ./Login
+ import() context element ./Login.js ./pages/ lazy ^\.\/.*$ namespace object ./Login.js
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/require.context/README.md b/examples/require.context/README.md
index 321edb576fa..237b4d49e12 100644
--- a/examples/require.context/README.md
+++ b/examples/require.context/README.md
@@ -122,8 +122,9 @@ module.exports = function() {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -142,7 +143,7 @@ module.exports = function() {
/************************************************************************/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/************************************************************************/
@@ -151,6 +152,8 @@ module.exports = function() {
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -173,29 +176,29 @@ console.log(getTemplate("b"));
## Unoptimized
```
-asset output.js 3.62 KiB [emitted] (name: main)
-chunk (runtime: main) output.js (main) 603 bytes (javascript) 86 bytes (runtime) [entry] [rendered]
+asset output.js 3.8 KiB [emitted] (name: main)
+chunk (runtime: main) output.js (main) 603 bytes (javascript) 88 bytes (runtime) [entry] [rendered]
> ./example.js main
dependent modules 457 bytes [dependent] 4 modules
- runtime modules 86 bytes 1 module
+ runtime modules 88 bytes 1 module
./example.js 146 bytes [built] [code generated]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 819 bytes [emitted] [minimized] (name: main)
-chunk (runtime: main) output.js (main) 603 bytes (javascript) 86 bytes (runtime) [entry] [rendered]
+asset output.js 833 bytes [emitted] [minimized] (name: main)
+chunk (runtime: main) output.js (main) 603 bytes (javascript) 88 bytes (runtime) [entry] [rendered]
> ./example.js main
dependent modules 457 bytes [dependent] 4 modules
- runtime modules 86 bytes 1 module
+ runtime modules 88 bytes 1 module
./example.js 146 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
# Code Splitting
diff --git a/examples/require.resolve/README.md b/examples/require.resolve/README.md
index 10ec3ef667c..d78646e8e4a 100644
--- a/examples/require.resolve/README.md
+++ b/examples/require.resolve/README.md
@@ -76,8 +76,9 @@ module.exports = Math.random();
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -105,10 +106,12 @@ module.exports = Math.random();
``` js
+/******/
/******/ // module cache are used so entry inlining is disabled
/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
+/******/ // Load entry module and return exports
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/
/******/ })()
;
```
@@ -118,25 +121,25 @@ module.exports = Math.random();
## Unoptimized
```
-asset output.js 2.31 KiB [emitted] (name: main)
+asset output.js 2.41 KiB [emitted] (name: main)
chunk (runtime: main) output.js (main) 313 bytes [entry] [rendered]
> ./example.js main
dependent modules 31 bytes [dependent] 1 module
./example.js 282 bytes [built] [code generated]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 297 bytes [emitted] [minimized] (name: main)
+asset output.js 311 bytes [emitted] [minimized] (name: main)
chunk (runtime: main) output.js (main) 313 bytes [entry] [rendered]
> ./example.js main
dependent modules 31 bytes [dependent] 1 module
./example.js 282 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/scope-hoisting/README.md b/examples/scope-hoisting/README.md
index 500f7173a9f..6bf03433229 100644
--- a/examples/scope-hoisting/README.md
+++ b/examples/scope-hoisting/README.md
@@ -4,17 +4,17 @@ This is the dependency graph for the example: (solid lines express sync imports,

-All modules except `cjs` are EcmaScript modules. `cjs` is a CommonJs module.
+All modules except `cjs` are EcmaScript modules. `cjs` is a CommonJS module.
-The interesting thing here is that putting all modules in single scope won't work, because of multiple reasons:
+The interesting thing here is that putting all modules in a single scope won't work, because of multiple reasons:
- Modules `lazy`, `c`, `d` and `cjs` need to be in a separate chunk
- Module `shared` is accessed by two chunks (different scopes)
-- Module `cjs` is a CommonJs module
+- Module `cjs` is a CommonJS module

-webpack therefore uses a approach called **"Partial Scope Hoisting"** or "Module concatenation", which chooses the largest possible subsets of ES modules which can be scope hoisted and combines them with the default webpack primitives.
+Webpack, therefore, uses an approach called **"Partial Scope Hoisting"** or "Module concatenation", which chooses the largest possible subsets of ES modules which can be scope hoisted and combines them with the default webpack primitives.

@@ -129,8 +129,8 @@ module.exports = {
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
- "x": () => /* binding */ x,
- "y": () => /* reexport */ y
+ "x": () => (/* binding */ x),
+ "y": () => (/* reexport */ y)
});
;// CONCATENATED MODULE: ./node_modules/shared2.js
@@ -157,8 +157,9 @@ var x = "x";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -214,7 +215,7 @@ var x = "x";
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -222,7 +223,7 @@ var x = "x";
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -252,10 +253,9 @@ var x = "x";
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -285,12 +285,11 @@ var x = "x";
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -302,9 +301,7 @@ var x = "x";
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -326,7 +323,7 @@ var x = "x";
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -340,39 +337,36 @@ var x = "x";
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -381,6 +375,8 @@ var x = "x";
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************************!*\
!*** ./example.js + 2 modules ***!
@@ -436,7 +432,7 @@ __webpack_require__.e(/*! import() */ 872).then(__webpack_require__.bind(__webpa
/*! other exports [not provided] [maybe used in main (runtime-defined)] */
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__, __webpack_require__.* */
/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/cjs.js: Module is not an ECMAScript module */
-/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shared.js: Module ./node_modules/shared.js is not in the same chunk(s) (expected in chunk(s) unnamed chunk(s), module is in chunk(s) main) */
+/*! ModuleConcatenation bailout: Cannot concat with ./node_modules/shared.js: Module ./node_modules/shared.js is not in the same chunk(s) (expected in chunk(s) unnamed chunk(s), module is in chunk(s) ) */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
"use strict";
@@ -445,17 +441,17 @@ __webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, {
- "c": () => /* reexport */ c,
- "d": () => /* reexport */ d_namespaceObject,
- "x": () => /* reexport */ shared.x,
- "y": () => /* reexport */ shared.y
+ "c": () => (/* reexport */ c),
+ "d": () => (/* reexport */ d_namespaceObject),
+ "x": () => (/* reexport */ shared.x),
+ "y": () => (/* reexport */ shared.y)
});
// NAMESPACE OBJECT: ./node_modules/d.js
var d_namespaceObject = {};
__webpack_require__.r(d_namespaceObject);
__webpack_require__.d(d_namespaceObject, {
- "a": () => a
+ "a": () => (a)
});
// EXTERNAL MODULE: ./node_modules/cjs.js
@@ -510,8 +506,8 @@ Minimized
## Unoptimized
```
-asset output.js 11.1 KiB [emitted] (name: main)
-asset 872.output.js 2.73 KiB [emitted]
+asset output.js 11.2 KiB [emitted] (name: main)
+asset 872.output.js 2.74 KiB [emitted]
chunk (runtime: main) output.js (main) 367 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered]
> ./example.js main
runtime modules 5.54 KiB 8 modules
@@ -526,13 +522,13 @@ chunk (runtime: main) 872.output.js 263 bytes [rendered]
./lazy.js + 2 modules 221 bytes [built] [code generated]
[exports: c, d, x, y]
import() ./lazy ./example.js + 2 modules ./example.js 4:0-16
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 2.1 KiB [emitted] [minimized] (name: main)
+asset output.js 2.11 KiB [emitted] [minimized] (name: main)
asset 872.output.js 270 bytes [emitted] [minimized]
chunk (runtime: main) output.js (main) 367 bytes (javascript) 5.54 KiB (runtime) [entry] [rendered]
> ./example.js main
@@ -548,5 +544,5 @@ chunk (runtime: main) 872.output.js 263 bytes [rendered]
./lazy.js + 2 modules 221 bytes [built] [code generated]
[exports: c, d, x, y]
import() ./lazy ./example.js + 2 modules ./example.js 4:0-16
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/scope-hoisting/template.md b/examples/scope-hoisting/template.md
index 7cb3b37bc4c..601a518e47c 100644
--- a/examples/scope-hoisting/template.md
+++ b/examples/scope-hoisting/template.md
@@ -4,9 +4,9 @@ This is the dependency graph for the example: (solid lines express sync imports,

-All modules except `cjs` are EcmaScript modules. `cjs` is a CommonJs module.
+All modules except `cjs` are EcmaScript modules. `cjs` is a CommonJS module.
-The interesting thing here is that putting all modules in single scope won't work, because of multiple reasons:
+The interesting thing here is that putting all modules in a single scope won't work, because of multiple reasons:
- Modules `lazy`, `c`, `d` and `cjs` need to be in a separate chunk
- Module `shared` is accessed by two chunks (different scopes)
@@ -14,7 +14,7 @@ The interesting thing here is that putting all modules in single scope won't wor

-webpack therefore uses a approach called **"Partial Scope Hoisting"** or "Module concatenation", which chooses the largest possible subsets of ES modules which can be scope hoisted and combines them with the default webpack primitives.
+Webpack, therefore, uses a approach called **"Partial Scope Hoisting"** or "Module concatenation", which chooses the largest possible subsets of ES modules which can be scope hoisted and combines them with the default webpack primitives.

diff --git a/examples/side-effects/README.md b/examples/side-effects/README.md
index e8beb2156a6..e2804cf9c23 100644
--- a/examples/side-effects/README.md
+++ b/examples/side-effects/README.md
@@ -1,4 +1,4 @@
-This example shows how the `sideEffects` flag for library authors works.
+This example shows how the `sideEffects` flag works for library authors.
The example contains a large library, `big-module`. `big-module` contains multiple child modules: `a`, `b` and `c`. The exports from the child modules are re-exported in the entry module (`index.js`) of the library. A consumer uses **some** of the exports, importing them from the library via `import { a, b } from "big-module"`. According to the EcmaScript spec, all child modules _must_ be evaluated because they could contain side effects.
@@ -60,32 +60,7 @@ console.log("side effect");
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
-/* 0 */
-/*!********************!*\
- !*** ./example.js ***!
- \********************/
-/*! namespace exports */
-/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
-/*! Statement (ExpressionStatement) with side effects in source code at 4:0-9:2 */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var big_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! big-module */ 1);
-/* harmony import */ var big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! big-module-with-flag */ 5);
-/* harmony import */ var big_module_with_flag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! big-module-with-flag */ 6);
-
-
-
-console.log(
- big_module__WEBPACK_IMPORTED_MODULE_0__.a,
- big_module__WEBPACK_IMPORTED_MODULE_0__.b,
- big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__.a,
- big_module_with_flag__WEBPACK_IMPORTED_MODULE_2__.b
-);
-
-
-/***/ }),
+/* 0 */,
/* 1 */
/*!******************************************!*\
!*** ./node_modules/big-module/index.js ***!
@@ -101,9 +76,9 @@ console.log(
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "a": () => /* reexport safe */ _a__WEBPACK_IMPORTED_MODULE_0__.a,
-/* harmony export */ "b": () => /* reexport safe */ _b__WEBPACK_IMPORTED_MODULE_1__.b,
-/* harmony export */ "c": () => /* reexport safe */ _c__WEBPACK_IMPORTED_MODULE_2__.c
+/* harmony export */ "a": () => (/* reexport safe */ _a__WEBPACK_IMPORTED_MODULE_0__.a),
+/* harmony export */ "b": () => (/* reexport safe */ _b__WEBPACK_IMPORTED_MODULE_1__.b),
+/* harmony export */ "c": () => (/* reexport safe */ _c__WEBPACK_IMPORTED_MODULE_2__.c)
/* harmony export */ });
/* harmony import */ var _a__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./a */ 2);
/* harmony import */ var _b__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./b */ 3);
@@ -128,7 +103,7 @@ console.log("side effect");
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "a": () => /* binding */ a
+/* harmony export */ "a": () => (/* binding */ a)
/* harmony export */ });
const a = "a";
@@ -146,7 +121,7 @@ const a = "a";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "b": () => /* binding */ b
+/* harmony export */ "b": () => (/* binding */ b)
/* harmony export */ });
const b = "b";
@@ -164,7 +139,7 @@ const b = "b";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "c": () => /* binding */ c
+/* harmony export */ "c": () => (/* binding */ c)
/* harmony export */ });
const c = "c";
@@ -182,7 +157,7 @@ const c = "c";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "a": () => /* binding */ a
+/* harmony export */ "a": () => (/* binding */ a)
/* harmony export */ });
const a = "a";
@@ -200,7 +175,7 @@ const a = "a";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "b": () => /* binding */ b
+/* harmony export */ "b": () => (/* binding */ b)
/* harmony export */ });
const b = "b";
@@ -219,8 +194,9 @@ const b = "b";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -251,7 +227,7 @@ const b = "b";
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
@@ -271,10 +247,32 @@ const b = "b";
``` js
-/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
-/******/ // This entry module used 'exports' so it can't be inlined
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+(() => {
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
+/*! Statement (ExpressionStatement) with side effects in source code at 4:0-9:2 */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var big_module__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! big-module */ 1);
+/* harmony import */ var big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! big-module-with-flag */ 5);
+/* harmony import */ var big_module_with_flag__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! big-module-with-flag */ 6);
+
+
+
+console.log(
+ big_module__WEBPACK_IMPORTED_MODULE_0__.a,
+ big_module__WEBPACK_IMPORTED_MODULE_0__.b,
+ big_module_with_flag__WEBPACK_IMPORTED_MODULE_1__.a,
+ big_module_with_flag__WEBPACK_IMPORTED_MODULE_2__.b
+);
+
+})();
+
/******/ })()
;
```
@@ -284,16 +282,16 @@ const b = "b";
## Unoptimized
```
-asset output.js 8.58 KiB [emitted] (name: main)
-chunk (runtime: main) output.js (main) 354 bytes (javascript) 668 bytes (runtime) [entry] [rendered]
+asset output.js 8.55 KiB [emitted] (name: main)
+chunk (runtime: main) output.js (main) 354 bytes (javascript) 670 bytes (runtime) [entry] [rendered]
> ./example.js main
dependent modules 214 bytes [dependent] 6 modules
- runtime modules 668 bytes 3 modules
+ runtime modules 670 bytes 3 modules
./example.js 140 bytes [built] [code generated]
[no exports]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
@@ -306,5 +304,5 @@ chunk (runtime: main) output.js (main) 332 bytes [entry] [rendered]
[no exports]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/side-effects/template.md b/examples/side-effects/template.md
index 258a491cb26..a8ae4f7281c 100644
--- a/examples/side-effects/template.md
+++ b/examples/side-effects/template.md
@@ -1,4 +1,4 @@
-This example shows how the `sideEffects` flag for library authors works.
+This example shows how the `sideEffects` flag works for library authors.
The example contains a large library, `big-module`. `big-module` contains multiple child modules: `a`, `b` and `c`. The exports from the child modules are re-exported in the entry module (`index.js`) of the library. A consumer uses **some** of the exports, importing them from the library via `import { a, b } from "big-module"`. According to the EcmaScript spec, all child modules _must_ be evaluated because they could contain side effects.
diff --git a/examples/source-map/README.md b/examples/source-map/README.md
index e3e21023943..ec7b610b8eb 100644
--- a/examples/source-map/README.md
+++ b/examples/source-map/README.md
@@ -85,12 +85,16 @@ race = function(winner, ...runners) {
/***/ })
],
-0,[[0,1]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
//# sourceMappingURL=bundle-source-map.js.map
```
```json
-{"version":3,"sources":["webpack:///./example.coffee"],"names":[],"mappings":";;;;;;;;;AAEU;;;AAAA;;AACV,OACE;EAAA,MAAQ,IAAI,CAAC,IAAb;EACA,QAAQ,MADR;EAEA,MAAQ,SAAC,CAAD;WAAO,IAAI,OAAO,CAAP;EAAX;AAFR,EAFQ;;;AAOV,OAAO,SAAC,MAAD,KAAS,OAAT;SACL,MAAM,MAAN,EAAc,OAAd;AADK","file":"./bundle-source-map.js","sourcesContent":["# Taken from http://coffeescript.org/\n\n# Objects:\nmath =\n root: Math.sqrt\n square: square\n cube: (x) -> x * square x\n\n# Splats:\nrace = (winner, runners...) ->\n print winner, runners\n"],"sourceRoot":""}
+{"version":3,"file":"./bundle-source-map.js","mappings":";;;;;;;;;AAEU;;;AAAA;;AACV,OACE;EAAA,MAAQ,IAAI,CAAC,IAAb;EACA,QAAQ,MADR;EAEA,MAAQ,SAAC,CAAD;WAAO,IAAI,OAAO,CAAP;EAAX;AAFR,EAFQ;;;AAOV,OAAO,SAAC,MAAD,KAAS,OAAT;SACL,MAAM,MAAN,EAAc,OAAd;AADK","sources":["webpack:///./example.coffee"],"sourcesContent":["# Taken from http://coffeescript.org/\n\n# Objects:\nmath =\n root: Math.sqrt\n square: square\n cube: (x) -> x * square x\n\n# Splats:\nrace = (winner, runners...) ->\n print winner, runners\n"],"names":[],"sourceRoot":""}
```
## hidden-source-map.js and hidden-source-map.js.map
@@ -126,11 +130,15 @@ race = function(winner, ...runners) {
/***/ })
],
-0,[[0,1]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
```
```json
-{"version":3,"sources":["webpack:///./example.coffee"],"names":[],"mappings":";;;;;;;;;AAEU;;;AAAA;;AACV,OACE;EAAA,MAAQ,IAAI,CAAC,IAAb;EACA,QAAQ,MADR;EAEA,MAAQ,SAAC,CAAD;WAAO,IAAI,OAAO,CAAP;EAAX;AAFR,EAFQ;;;AAOV,OAAO,SAAC,MAAD,KAAS,OAAT;SACL,MAAM,MAAN,EAAc,OAAd;AADK","file":"./bundle-hidden-source-map.js","sourcesContent":["# Taken from http://coffeescript.org/\n\n# Objects:\nmath =\n root: Math.sqrt\n square: square\n cube: (x) -> x * square x\n\n# Splats:\nrace = (winner, runners...) ->\n print winner, runners\n"],"sourceRoot":""}
+{"version":3,"file":"./bundle-hidden-source-map.js","mappings":";;;;;;;;;AAEU;;;AAAA;;AACV,OACE;EAAA,MAAQ,IAAI,CAAC,IAAb;EACA,QAAQ,MADR;EAEA,MAAQ,SAAC,CAAD;WAAO,IAAI,OAAO,CAAP;EAAX;AAFR,EAFQ;;;AAOV,OAAO,SAAC,MAAD,KAAS,OAAT;SACL,MAAM,MAAN,EAAc,OAAd;AADK","sources":["webpack:///./example.coffee"],"sourcesContent":["# Taken from http://coffeescript.org/\n\n# Objects:\nmath =\n root: Math.sqrt\n square: square\n cube: (x) -> x * square x\n\n# Splats:\nrace = (winner, runners...) ->\n print winner, runners\n"],"names":[],"sourceRoot":""}
```
## inline-source-map.js
@@ -166,14 +174,18 @@ race = function(winner, ...runners) {
/***/ })
],
-0,[[0,1]]]);
-//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJzb3VyY2VzIjpbIndlYnBhY2s6Ly8vLi9leGFtcGxlLmNvZmZlZSJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7QUFFVTs7O0FBQUE7O0FBQ1YsT0FDRTtFQUFBLE1BQVEsSUFBSSxDQUFDLElBQWI7RUFDQSxRQUFRLE1BRFI7RUFFQSxNQUFRLFNBQUMsQ0FBRDtXQUFPLElBQUksT0FBTyxDQUFQO0VBQVg7QUFGUixFQUZROzs7QUFPVixPQUFPLFNBQUMsTUFBRCxLQUFTLE9BQVQ7U0FDTCxNQUFNLE1BQU4sRUFBYyxPQUFkO0FBREsiLCJmaWxlIjoiLi9idW5kbGUtaW5saW5lLXNvdXJjZS1tYXAuanMiLCJzb3VyY2VzQ29udGVudCI6WyIjIFRha2VuIGZyb20gaHR0cDovL2NvZmZlZXNjcmlwdC5vcmcvXG5cbiMgT2JqZWN0czpcbm1hdGggPVxuICByb290OiAgIE1hdGguc3FydFxuICBzcXVhcmU6IHNxdWFyZVxuICBjdWJlOiAgICh4KSAtPiB4ICogc3F1YXJlIHhcblxuIyBTcGxhdHM6XG5yYWNlID0gKHdpbm5lciwgcnVubmVycy4uLikgLT5cbiAgcHJpbnQgd2lubmVyLCBydW5uZXJzXG4iXSwic291cmNlUm9vdCI6IiJ9
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
+//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiLi9idW5kbGUtaW5saW5lLXNvdXJjZS1tYXAuanMiLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7O0FBRVU7OztBQUFBOztBQUNWLE9BQ0U7RUFBQSxNQUFRLElBQUksQ0FBQyxJQUFiO0VBQ0EsUUFBUSxNQURSO0VBRUEsTUFBUSxTQUFDLENBQUQ7V0FBTyxJQUFJLE9BQU8sQ0FBUDtFQUFYO0FBRlIsRUFGUTs7O0FBT1YsT0FBTyxTQUFDLE1BQUQsS0FBUyxPQUFUO1NBQ0wsTUFBTSxNQUFOLEVBQWMsT0FBZDtBQURLIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWUiXSwic291cmNlc0NvbnRlbnQiOlsiIyBUYWtlbiBmcm9tIGh0dHA6Ly9jb2ZmZWVzY3JpcHQub3JnL1xuXG4jIE9iamVjdHM6XG5tYXRoID1cbiAgcm9vdDogICBNYXRoLnNxcnRcbiAgc3F1YXJlOiBzcXVhcmVcbiAgY3ViZTogICAoeCkgLT4geCAqIHNxdWFyZSB4XG5cbiMgU3BsYXRzOlxucmFjZSA9ICh3aW5uZXIsIHJ1bm5lcnMuLi4pIC0+XG4gIHByaW50IHdpbm5lciwgcnVubmVyc1xuIl0sIm5hbWVzIjpbXSwic291cmNlUm9vdCI6IiJ9
```
## nosources-source-map.js.map
```json
-{"version":3,"sources":["webpack:///./example.coffee"],"names":[],"mappings":";;;;;;;;;AAEU;;;AAAA;;AACV,OACE;EAAA,MAAQ,IAAI,CAAC,IAAb;EACA,QAAQ,MADR;EAEA,MAAQ,SAAC,CAAD;WAAO,IAAI,OAAO,CAAP;EAAX;AAFR,EAFQ;;;AAOV,OAAO,SAAC,MAAD,KAAS,OAAT;SACL,MAAM,MAAN,EAAc,OAAd;AADK","file":"./bundle-nosources-source-map.js","sourceRoot":""}
+{"version":3,"file":"./bundle-nosources-source-map.js","mappings":";;;;;;;;;AAEU;;;AAAA;;AACV,OACE;EAAA,MAAQ,IAAI,CAAC,IAAb;EACA,QAAQ,MADR;EAEA,MAAQ,SAAC,CAAD;WAAO,IAAI,OAAO,CAAP;EAAX;AAFR,EAFQ;;;AAOV,OAAO,SAAC,MAAD,KAAS,OAAT;SACL,MAAM,MAAN,EAAc,OAAd;AADK","sources":["webpack:///./example.coffee"],"names":[],"sourceRoot":""}
```
## eval-source-map.js
@@ -200,7 +212,11 @@ eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\n
/***/ })
],
-0,[[0,1]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
```
## eval.js
@@ -227,7 +243,11 @@ eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\n
/***/ })
],
-0,[[0,1]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
```
## eval-cheap-source-map.js
@@ -250,11 +270,15 @@ eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\n
/*! runtime requirements: */
/***/ (() => {
-eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsInNvdXJjZXMiOlsid2VicGFjazovLy8uL2V4YW1wbGUuY29mZmVlP2VlNTgiXSwic291cmNlc0NvbnRlbnQiOlsiLy8gVGFrZW4gZnJvbSBodHRwOi8vY29mZmVlc2NyaXB0Lm9yZy9cblxuLy8gT2JqZWN0czpcbnZhciBtYXRoLCByYWNlO1xuXG5tYXRoID0ge1xuICByb290OiBNYXRoLnNxcnQsXG4gIHNxdWFyZTogc3F1YXJlLFxuICBjdWJlOiBmdW5jdGlvbih4KSB7XG4gICAgcmV0dXJuIHggKiBzcXVhcmUoeCk7XG4gIH1cbn07XG5cbi8vIFNwbGF0czpcbnJhY2UgPSBmdW5jdGlvbih3aW5uZXIsIC4uLnJ1bm5lcnMpIHtcbiAgcmV0dXJuIHByaW50KHdpbm5lciwgcnVubmVycyk7XG59O1xuIl0sIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBOyIsInNvdXJjZVJvb3QiOiIifQ==\n//# sourceURL=webpack-internal:///0\n");
+eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n//# sourceURL=[module]\n//# sourceMappingURL=data:application/json;charset=utf-8;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiMC5qcyIsIm1hcHBpbmdzIjoiQUFBQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBO0FBQ0E7QUFDQTtBQUNBIiwic291cmNlcyI6WyJ3ZWJwYWNrOi8vLy4vZXhhbXBsZS5jb2ZmZWU/ZWU1OCJdLCJzb3VyY2VzQ29udGVudCI6WyIvLyBUYWtlbiBmcm9tIGh0dHA6Ly9jb2ZmZWVzY3JpcHQub3JnL1xuXG4vLyBPYmplY3RzOlxudmFyIG1hdGgsIHJhY2U7XG5cbm1hdGggPSB7XG4gIHJvb3Q6IE1hdGguc3FydCxcbiAgc3F1YXJlOiBzcXVhcmUsXG4gIGN1YmU6IGZ1bmN0aW9uKHgpIHtcbiAgICByZXR1cm4geCAqIHNxdWFyZSh4KTtcbiAgfVxufTtcblxuLy8gU3BsYXRzOlxucmFjZSA9IGZ1bmN0aW9uKHdpbm5lciwgLi4ucnVubmVycykge1xuICByZXR1cm4gcHJpbnQod2lubmVyLCBydW5uZXJzKTtcbn07XG4iXSwibmFtZXMiOltdLCJzb3VyY2VSb290IjoiIn0=\n//# sourceURL=webpack-internal:///0\n");
/***/ })
],
-0,[[0,1]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
```
## eval-cheap-module-source-map.js
@@ -281,177 +305,181 @@ eval("// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\n
/***/ })
],
-0,[[0,1]]]);
+/******/ __webpack_require__ => { // webpackRuntimeModules
+/******/ var __webpack_exec__ = (moduleId) => (__webpack_require__(__webpack_require__.s = moduleId))
+/******/ var __webpack_exports__ = (__webpack_exec__(0));
+/******/ }
+]);
```
## cheap-module-source-map.js.map
```json
-{"version":3,"file":"./bundle-cheap-module-source-map.js","sources":["webpack:///./example.coffee"],"sourcesContent":["# Taken from http://coffeescript.org/\n\n# Objects:\nmath =\n root: Math.sqrt\n square: square\n cube: (x) -> x * square x\n\n# Splats:\nrace = (winner, runners...) ->\n print winner, runners\n"],"mappings":";;;;;;;;;AAEA;AACA;;AADA;AACA;AAAA;AACA;AACA;AACA;AAAA;AAAA;AAFA;AACA;;AAIA;AACA;AADA;AACA;AACA;A;;A","sourceRoot":""}
+{"version":3,"file":"./bundle-cheap-module-source-map.js","mappings":";;;;;;;;;AAEA;;;AAAA;;AACA;AACA;AACA;AACA;AAAA;AAAA;AAFA;;;AAKA;AACA;AADA","sources":["webpack:///./example.coffee"],"sourcesContent":["# Taken from http://coffeescript.org/\n\n# Objects:\nmath =\n root: Math.sqrt\n square: square\n cube: (x) -> x * square x\n\n# Splats:\nrace = (winner, runners...) ->\n print winner, runners\n"],"names":[],"sourceRoot":""}
```
## cheap-source-map.js.map
```json
-{"version":3,"file":"./bundle-cheap-source-map.js","sources":["webpack:///./example.coffee"],"sourcesContent":["// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n"],"mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;A;;A","sourceRoot":""}
+{"version":3,"file":"./bundle-cheap-source-map.js","mappings":";;;;;;;;;AAAA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","sources":["webpack:///./example.coffee"],"sourcesContent":["// Taken from http://coffeescript.org/\n\n// Objects:\nvar math, race;\n\nmath = {\n root: Math.sqrt,\n square: square,\n cube: function(x) {\n return x * square(x);\n }\n};\n\n// Splats:\nrace = function(winner, ...runners) {\n return print(winner, runners);\n};\n"],"names":[],"sourceRoot":""}
```
# webpack output
```
-asset ./runtime~bundle-eval.js 5.72 KiB [emitted] (name: runtime~bundle)
-asset ./bundle-eval.js 1.32 KiB [emitted] (name: bundle)
-Entrypoint bundle 7.04 KiB = ./runtime~bundle-eval.js 5.72 KiB ./bundle-eval.js 1.32 KiB
+asset ./runtime~bundle-eval.js 5.46 KiB [emitted] (name: runtime~bundle)
+asset ./bundle-eval.js 1.53 KiB [emitted] (name: bundle)
+Entrypoint bundle 6.99 KiB = ./runtime~bundle-eval.js 5.46 KiB ./bundle-eval.js 1.53 KiB
chunk (runtime: runtime~bundle) ./bundle-eval.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-eval.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-eval.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-eval-cheap-source-map.js 5.72 KiB [emitted] (name: runtime~bundle)
-asset ./bundle-eval-cheap-source-map.js 1.98 KiB [emitted] (name: bundle)
-Entrypoint bundle 7.7 KiB = ./runtime~bundle-eval-cheap-source-map.js 5.72 KiB ./bundle-eval-cheap-source-map.js 1.98 KiB
+asset ./runtime~bundle-eval-cheap-source-map.js 5.45 KiB [emitted] (name: runtime~bundle)
+asset ./bundle-eval-cheap-source-map.js 2.2 KiB [emitted] (name: bundle)
+Entrypoint bundle 7.65 KiB = ./runtime~bundle-eval-cheap-source-map.js 5.45 KiB ./bundle-eval-cheap-source-map.js 2.2 KiB
chunk (runtime: runtime~bundle) ./bundle-eval-cheap-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-eval-cheap-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-eval-cheap-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-eval-cheap-module-source-map.js 5.72 KiB [emitted] (name: runtime~bundle)
-asset ./bundle-eval-cheap-module-source-map.js 2.12 KiB [emitted] (name: bundle)
-Entrypoint bundle 7.84 KiB = ./runtime~bundle-eval-cheap-module-source-map.js 5.72 KiB ./bundle-eval-cheap-module-source-map.js 2.12 KiB
+asset ./runtime~bundle-eval-cheap-module-source-map.js 5.45 KiB [emitted] (name: runtime~bundle)
+asset ./bundle-eval-cheap-module-source-map.js 2.33 KiB [emitted] (name: bundle)
+Entrypoint bundle 7.79 KiB = ./runtime~bundle-eval-cheap-module-source-map.js 5.45 KiB ./bundle-eval-cheap-module-source-map.js 2.33 KiB
chunk (runtime: runtime~bundle) ./bundle-eval-cheap-module-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-eval-cheap-module-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-eval-cheap-module-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-eval-source-map.js 5.72 KiB [emitted] (name: runtime~bundle)
-asset ./bundle-eval-source-map.js 2.12 KiB [emitted] (name: bundle)
-Entrypoint bundle 7.84 KiB = ./runtime~bundle-eval-source-map.js 5.72 KiB ./bundle-eval-source-map.js 2.12 KiB
+asset ./runtime~bundle-eval-source-map.js 5.45 KiB [emitted] (name: runtime~bundle)
+asset ./bundle-eval-source-map.js 2.33 KiB [emitted] (name: bundle)
+Entrypoint bundle 7.79 KiB = ./runtime~bundle-eval-source-map.js 5.45 KiB ./bundle-eval-source-map.js 2.33 KiB
chunk (runtime: runtime~bundle) ./bundle-eval-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-eval-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-eval-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-cheap-source-map.js 5.23 KiB [emitted] (name: runtime~bundle) 1 related asset
-asset ./bundle-cheap-source-map.js 717 bytes [emitted] (name: bundle) 1 related asset
-Entrypoint bundle 5.93 KiB (5.01 KiB) = ./runtime~bundle-cheap-source-map.js 5.23 KiB ./bundle-cheap-source-map.js 717 bytes 2 auxiliary assets
+asset ./runtime~bundle-cheap-source-map.js 4.97 KiB [emitted] (name: runtime~bundle) 1 related asset
+asset ./bundle-cheap-source-map.js 938 bytes [emitted] (name: bundle) 1 related asset
+Entrypoint bundle 5.88 KiB (4.83 KiB) = ./runtime~bundle-cheap-source-map.js 4.97 KiB ./bundle-cheap-source-map.js 938 bytes 2 auxiliary assets
chunk (runtime: runtime~bundle) ./bundle-cheap-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-cheap-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-cheap-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-cheap-module-source-map.js 5.24 KiB [emitted] (name: runtime~bundle) 1 related asset
-asset ./bundle-cheap-module-source-map.js 724 bytes [emitted] (name: bundle) 1 related asset
-Entrypoint bundle 5.94 KiB (4.95 KiB) = ./runtime~bundle-cheap-module-source-map.js 5.24 KiB ./bundle-cheap-module-source-map.js 724 bytes 2 auxiliary assets
+asset ./runtime~bundle-cheap-module-source-map.js 4.97 KiB [emitted] (name: runtime~bundle) 1 related asset
+asset ./bundle-cheap-module-source-map.js 945 bytes [emitted] (name: bundle) 1 related asset
+Entrypoint bundle 5.9 KiB (4.76 KiB) = ./runtime~bundle-cheap-module-source-map.js 4.97 KiB ./bundle-cheap-module-source-map.js 945 bytes 2 auxiliary assets
chunk (runtime: runtime~bundle) ./bundle-cheap-module-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-cheap-module-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-cheap-module-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-inline-cheap-source-map.js 11.2 KiB [emitted] (name: runtime~bundle)
-asset ./bundle-inline-cheap-source-map.js 1.41 KiB [emitted] (name: bundle)
-Entrypoint bundle 12.7 KiB = ./runtime~bundle-inline-cheap-source-map.js 11.2 KiB ./bundle-inline-cheap-source-map.js 1.41 KiB
+asset ./runtime~bundle-inline-cheap-source-map.js 10.7 KiB [emitted] (name: runtime~bundle)
+asset ./bundle-inline-cheap-source-map.js 1.62 KiB [emitted] (name: bundle)
+Entrypoint bundle 12.4 KiB = ./runtime~bundle-inline-cheap-source-map.js 10.7 KiB ./bundle-inline-cheap-source-map.js 1.62 KiB
chunk (runtime: runtime~bundle) ./bundle-inline-cheap-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-inline-cheap-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-inline-cheap-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-inline-cheap-module-source-map.js 11.3 KiB [emitted] (name: runtime~bundle)
-asset ./bundle-inline-cheap-module-source-map.js 1.31 KiB [emitted] (name: bundle)
-Entrypoint bundle 12.6 KiB = ./runtime~bundle-inline-cheap-module-source-map.js 11.3 KiB ./bundle-inline-cheap-module-source-map.js 1.31 KiB
+asset ./runtime~bundle-inline-cheap-module-source-map.js 10.8 KiB [emitted] (name: runtime~bundle)
+asset ./bundle-inline-cheap-module-source-map.js 1.51 KiB [emitted] (name: bundle)
+Entrypoint bundle 12.3 KiB = ./runtime~bundle-inline-cheap-module-source-map.js 10.8 KiB ./bundle-inline-cheap-module-source-map.js 1.51 KiB
chunk (runtime: runtime~bundle) ./bundle-inline-cheap-module-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-inline-cheap-module-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-inline-cheap-module-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-source-map.js 5.22 KiB [emitted] (name: runtime~bundle) 1 related asset
-asset ./bundle-source-map.js 711 bytes [emitted] (name: bundle) 1 related asset
-Entrypoint bundle 5.92 KiB (5.01 KiB) = ./runtime~bundle-source-map.js 5.22 KiB ./bundle-source-map.js 711 bytes 2 auxiliary assets
+asset ./runtime~bundle-source-map.js 4.96 KiB [emitted] (name: runtime~bundle) 1 related asset
+asset ./bundle-source-map.js 932 bytes [emitted] (name: bundle) 1 related asset
+Entrypoint bundle 5.87 KiB (4.85 KiB) = ./runtime~bundle-source-map.js 4.96 KiB ./bundle-source-map.js 932 bytes 2 auxiliary assets
chunk (runtime: runtime~bundle) ./bundle-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-inline-source-map.js 11.2 KiB [emitted] (name: runtime~bundle)
-asset ./bundle-inline-source-map.js 1.42 KiB [emitted] (name: bundle)
-Entrypoint bundle 12.6 KiB = ./runtime~bundle-inline-source-map.js 11.2 KiB ./bundle-inline-source-map.js 1.42 KiB
+asset ./runtime~bundle-inline-source-map.js 10.7 KiB [emitted] (name: runtime~bundle)
+asset ./bundle-inline-source-map.js 1.64 KiB [emitted] (name: bundle)
+Entrypoint bundle 12.4 KiB = ./runtime~bundle-inline-source-map.js 10.7 KiB ./bundle-inline-source-map.js 1.64 KiB
chunk (runtime: runtime~bundle) ./bundle-inline-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-inline-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-inline-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-hidden-source-map.js 5.17 KiB [emitted] (name: runtime~bundle) 1 related asset
-asset ./bundle-hidden-source-map.js 665 bytes [emitted] (name: bundle) 1 related asset
-Entrypoint bundle 5.82 KiB (5.02 KiB) = ./runtime~bundle-hidden-source-map.js 5.17 KiB ./bundle-hidden-source-map.js 665 bytes 2 auxiliary assets
+asset ./runtime~bundle-hidden-source-map.js 4.91 KiB [emitted] (name: runtime~bundle) 1 related asset
+asset ./bundle-hidden-source-map.js 886 bytes [emitted] (name: bundle) 1 related asset
+Entrypoint bundle 5.77 KiB (4.87 KiB) = ./runtime~bundle-hidden-source-map.js 4.91 KiB ./bundle-hidden-source-map.js 886 bytes 2 auxiliary assets
chunk (runtime: runtime~bundle) ./bundle-hidden-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-hidden-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-hidden-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
-asset ./runtime~bundle-nosources-source-map.js 5.23 KiB [emitted] (name: runtime~bundle) 1 related asset
-asset ./bundle-nosources-source-map.js 721 bytes [emitted] (name: bundle) 1 related asset
-Entrypoint bundle 5.94 KiB (1.16 KiB) = ./runtime~bundle-nosources-source-map.js 5.23 KiB ./bundle-nosources-source-map.js 721 bytes 2 auxiliary assets
+asset ./runtime~bundle-nosources-source-map.js 4.97 KiB [emitted] (name: runtime~bundle) 1 related asset
+asset ./bundle-nosources-source-map.js 942 bytes [emitted] (name: bundle) 1 related asset
+Entrypoint bundle 5.89 KiB (1.24 KiB) = ./runtime~bundle-nosources-source-map.js 4.97 KiB ./bundle-nosources-source-map.js 942 bytes 2 auxiliary assets
chunk (runtime: runtime~bundle) ./bundle-nosources-source-map.js (bundle) 256 bytes [initial] [rendered]
> coffee-loader!./example.coffee bundle
../../node_modules/coffee-loader/dist/cjs.js!./example.coffee 256 bytes [built] [code generated]
[used exports unknown]
entry coffee-loader!./example.coffee bundle
-chunk (runtime: runtime~bundle) ./runtime~bundle-nosources-source-map.js (runtime~bundle) 2.56 KiB [entry] [rendered]
+chunk (runtime: runtime~bundle) ./runtime~bundle-nosources-source-map.js (runtime~bundle) 2.45 KiB [entry] [rendered]
> coffee-loader!./example.coffee bundle
- runtime modules 2.56 KiB 2 modules
-webpack 5.11.1 compiled successfully
+ runtime modules 2.45 KiB 3 modules
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/source-map/webpack.config.js b/examples/source-map/webpack.config.js
index 27496c2df62..effd0892118 100644
--- a/examples/source-map/webpack.config.js
+++ b/examples/source-map/webpack.config.js
@@ -1,4 +1,4 @@
-var path = require("path");
+const path = require("path");
module.exports = [
"eval",
diff --git a/examples/stats-detailed/README.md b/examples/stats-detailed/README.md
new file mode 100644
index 00000000000..18e05d2780f
--- /dev/null
+++ b/examples/stats-detailed/README.md
@@ -0,0 +1,83 @@
+This configuration will enable the detailed output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+console.log("Hello World!");
+```
+
+# webpack.config.js
+
+```javascript
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "detailed"
+};
+```
+
+# dist/output.js
+
+```javascript
+/******/ (() => { // webpackBootstrap
+var __webpack_exports__ = {};
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: */
+console.log("Hello World!");
+
+/******/ })()
+;
+```
+
+# Info
+
+## Production mode
+
+```
+PublicPath: dist/
+asset output.js 28 bytes {179} [emitted] [minimized] (name: main)
+Entrypoint main 28 bytes = output.js
+chunk {179} (runtime: main) output.js (main) 29 bytes [entry] [rendered]
+ > ./example.js main
+./example.js [144] 29 bytes {179} [depth 0] [built] [code generated]
+ [no exports used]
+ Statement (ExpressionStatement) with side effects in source code at 1:0-28
+ ModuleConcatenation bailout: Module is not an ECMAScript module
+
+LOG from webpack.Compilation
+ 1 modules hashed, 0 from cache (1 variants per module in average)
+ 100% code generated (1 generated, 0 from cache)
++ 24 hidden lines
+
+LOG from webpack.FlagDependencyExportsPlugin
+ 0% of exports of modules have been determined (1 no declared exports, 0 not cached, 0 flagged uncacheable, 0 from cache, 0 from mem cache, 0 additional calculations due to dependencies)
++ 3 hidden lines
+
+LOG from webpack.buildChunkGraph
+ 2 queue items processed (1 blocks)
+ 0 chunk groups connected
+ 0 chunk groups processed for merging (0 module sets, 0 forked, 0 + 0 modules forked, 0 + 0 modules merged into fork, 0 resulting modules)
+ 0 chunk group info updated (0 already connected chunk groups reconnected)
++ 5 hidden lines
+
+LOG from webpack.FileSystemInfo
+ 1 new snapshots created
+ 0% root snapshot uncached (0 / 0)
+ 0% children snapshot uncached (0 / 0)
+ 0 entries tested
+ File info in cache: 1 timestamps 1 hashes 1 timestamp hash combinations
+ File timestamp hash combination snapshot optimization: 0% (0/1) entries shared via 0 shared snapshots (0 times referenced)
+ Directory info in cache: 0 timestamps 0 hashes 0 timestamp hash combinations
+ Managed items info in cache: 0 items
+
+2023-06-23 22:57:08: webpack 5.88.0 compiled successfully (208f5e6e78a48d3e157f)
+```
diff --git a/examples/stats-detailed/build.js b/examples/stats-detailed/build.js
new file mode 100644
index 00000000000..6da1216015d
--- /dev/null
+++ b/examples/stats-detailed/build.js
@@ -0,0 +1,4 @@
+global.NO_REASONS = true;
+global.NO_STATS_OPTIONS = true;
+global.STATS_COLORS = true;
+require("../build-common");
diff --git a/examples/stats-detailed/example.js b/examples/stats-detailed/example.js
new file mode 100644
index 00000000000..019c0f4bc8e
--- /dev/null
+++ b/examples/stats-detailed/example.js
@@ -0,0 +1 @@
+console.log("Hello World!");
diff --git a/examples/stats-detailed/template.md b/examples/stats-detailed/template.md
new file mode 100644
index 00000000000..d475f06a46f
--- /dev/null
+++ b/examples/stats-detailed/template.md
@@ -0,0 +1,29 @@
+This configuration will enable the detailed output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# webpack.config.js
+
+```javascript
+_{{webpack.config.js}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# Info
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/stats-detailed/webpack.config.js b/examples/stats-detailed/webpack.config.js
new file mode 100644
index 00000000000..a237a81fc37
--- /dev/null
+++ b/examples/stats-detailed/webpack.config.js
@@ -0,0 +1,9 @@
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "detailed"
+};
diff --git a/examples/stats-minimal/README.md b/examples/stats-minimal/README.md
new file mode 100644
index 00000000000..a0cfb112a38
--- /dev/null
+++ b/examples/stats-minimal/README.md
@@ -0,0 +1,49 @@
+This configuration will enable the minimal output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+console.log("Hello World!");
+```
+
+# webpack.config.js
+
+```javascript
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "minimal"
+};
+```
+
+# dist/output.js
+
+```javascript
+/******/ (() => { // webpackBootstrap
+var __webpack_exports__ = {};
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: */
+console.log("Hello World!");
+
+/******/ })()
+;
+```
+
+# Info
+
+## Production mode
+
+```
+1 asset
+1 module
+webpack 5.87.0 compiled successfully
+```
\ No newline at end of file
diff --git a/examples/stats-minimal/build.js b/examples/stats-minimal/build.js
new file mode 100644
index 00000000000..6da1216015d
--- /dev/null
+++ b/examples/stats-minimal/build.js
@@ -0,0 +1,4 @@
+global.NO_REASONS = true;
+global.NO_STATS_OPTIONS = true;
+global.STATS_COLORS = true;
+require("../build-common");
diff --git a/examples/stats-minimal/example.js b/examples/stats-minimal/example.js
new file mode 100644
index 00000000000..019c0f4bc8e
--- /dev/null
+++ b/examples/stats-minimal/example.js
@@ -0,0 +1 @@
+console.log("Hello World!");
diff --git a/examples/stats-minimal/template.md b/examples/stats-minimal/template.md
new file mode 100644
index 00000000000..24ffaaa57df
--- /dev/null
+++ b/examples/stats-minimal/template.md
@@ -0,0 +1,29 @@
+This configuration will enable the minimal output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# webpack.config.js
+
+```javascript
+_{{webpack.config.js}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# Info
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
\ No newline at end of file
diff --git a/examples/stats-minimal/webpack.config.js b/examples/stats-minimal/webpack.config.js
new file mode 100644
index 00000000000..22fbf8330b2
--- /dev/null
+++ b/examples/stats-minimal/webpack.config.js
@@ -0,0 +1,9 @@
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "minimal"
+};
diff --git a/examples/stats-none/README.md b/examples/stats-none/README.md
new file mode 100644
index 00000000000..b1fe4195d04
--- /dev/null
+++ b/examples/stats-none/README.md
@@ -0,0 +1,47 @@
+This configuration will enable the none output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+console.log("Hello World!");
+```
+
+# webpack.config.js
+
+```javascript
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "none"
+};
+```
+
+# dist/output.js
+
+```javascript
+/******/ (() => { // webpackBootstrap
+var __webpack_exports__ = {};
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: */
+console.log("Hello World!");
+
+/******/ })()
+;
+```
+
+# Info
+
+## Production mode
+
+```
+
+```
diff --git a/examples/stats-none/build.js b/examples/stats-none/build.js
new file mode 100644
index 00000000000..6da1216015d
--- /dev/null
+++ b/examples/stats-none/build.js
@@ -0,0 +1,4 @@
+global.NO_REASONS = true;
+global.NO_STATS_OPTIONS = true;
+global.STATS_COLORS = true;
+require("../build-common");
diff --git a/examples/stats-none/example.js b/examples/stats-none/example.js
new file mode 100644
index 00000000000..019c0f4bc8e
--- /dev/null
+++ b/examples/stats-none/example.js
@@ -0,0 +1 @@
+console.log("Hello World!");
diff --git a/examples/stats-none/template.md b/examples/stats-none/template.md
new file mode 100644
index 00000000000..b60135662a4
--- /dev/null
+++ b/examples/stats-none/template.md
@@ -0,0 +1,29 @@
+This configuration will enable the none output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# webpack.config.js
+
+```javascript
+_{{webpack.config.js}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# Info
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/stats-none/webpack.config.js b/examples/stats-none/webpack.config.js
new file mode 100644
index 00000000000..8a687239693
--- /dev/null
+++ b/examples/stats-none/webpack.config.js
@@ -0,0 +1,9 @@
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "none"
+};
diff --git a/examples/stats-normal/README.md b/examples/stats-normal/README.md
new file mode 100644
index 00000000000..becfd3e06c1
--- /dev/null
+++ b/examples/stats-normal/README.md
@@ -0,0 +1,49 @@
+This configuration will enable the normal output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+console.log("Hello World!");
+```
+
+# webpack.config.js
+
+```javascript
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "normal"
+};
+```
+
+# dist/output.js
+
+```javascript
+/******/ (() => { // webpackBootstrap
+var __webpack_exports__ = {};
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: */
+console.log("Hello World!");
+
+/******/ })()
+;
+```
+
+# Info
+
+## Production mode
+
+```
+asset output.js 28 bytes [emitted] [minimized] (name: main)
+./example.js 29 bytes [built] [code generated]
+webpack 5.88.0 compiled successfully
+```
\ No newline at end of file
diff --git a/examples/stats-normal/build.js b/examples/stats-normal/build.js
new file mode 100644
index 00000000000..6da1216015d
--- /dev/null
+++ b/examples/stats-normal/build.js
@@ -0,0 +1,4 @@
+global.NO_REASONS = true;
+global.NO_STATS_OPTIONS = true;
+global.STATS_COLORS = true;
+require("../build-common");
diff --git a/examples/stats-normal/example.js b/examples/stats-normal/example.js
new file mode 100644
index 00000000000..019c0f4bc8e
--- /dev/null
+++ b/examples/stats-normal/example.js
@@ -0,0 +1 @@
+console.log("Hello World!");
diff --git a/examples/stats-normal/template.md b/examples/stats-normal/template.md
new file mode 100644
index 00000000000..ed4c81681b5
--- /dev/null
+++ b/examples/stats-normal/template.md
@@ -0,0 +1,29 @@
+This configuration will enable the normal output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# webpack.config.js
+
+```javascript
+_{{webpack.config.js}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# Info
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
\ No newline at end of file
diff --git a/examples/stats-normal/webpack.config.js b/examples/stats-normal/webpack.config.js
new file mode 100644
index 00000000000..e741993c8d9
--- /dev/null
+++ b/examples/stats-normal/webpack.config.js
@@ -0,0 +1,9 @@
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "normal"
+};
diff --git a/examples/stats-summary/README.md b/examples/stats-summary/README.md
new file mode 100644
index 00000000000..7ebee7c56d0
--- /dev/null
+++ b/examples/stats-summary/README.md
@@ -0,0 +1,47 @@
+This configuration will enable the summary output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+console.log("Hello World!");
+```
+
+# webpack.config.js
+
+```javascript
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "summary"
+};
+```
+
+# dist/output.js
+
+```javascript
+/******/ (() => { // webpackBootstrap
+var __webpack_exports__ = {};
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! unknown exports (runtime-defined) */
+/*! runtime requirements: */
+console.log("Hello World!");
+
+/******/ })()
+;
+```
+
+# Info
+
+## Production mode
+
+```
+webpack 5.88.0 compiled successfully
+```
diff --git a/examples/stats-summary/build.js b/examples/stats-summary/build.js
new file mode 100644
index 00000000000..6da1216015d
--- /dev/null
+++ b/examples/stats-summary/build.js
@@ -0,0 +1,4 @@
+global.NO_REASONS = true;
+global.NO_STATS_OPTIONS = true;
+global.STATS_COLORS = true;
+require("../build-common");
diff --git a/examples/stats-summary/example.js b/examples/stats-summary/example.js
new file mode 100644
index 00000000000..019c0f4bc8e
--- /dev/null
+++ b/examples/stats-summary/example.js
@@ -0,0 +1 @@
+console.log("Hello World!");
diff --git a/examples/stats-summary/template.md b/examples/stats-summary/template.md
new file mode 100644
index 00000000000..087cfc32b5f
--- /dev/null
+++ b/examples/stats-summary/template.md
@@ -0,0 +1,29 @@
+This configuration will enable the summary output for the stats report.
+
+You see that everything is working nicely together.
+
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# webpack.config.js
+
+```javascript
+_{{webpack.config.js}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# Info
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/stats-summary/webpack.config.js b/examples/stats-summary/webpack.config.js
new file mode 100644
index 00000000000..94e9a0f0b2d
--- /dev/null
+++ b/examples/stats-summary/webpack.config.js
@@ -0,0 +1,9 @@
+const path = require("path");
+
+module.exports = {
+ output: {
+ path: path.join(__dirname, "dist"),
+ filename: "output.js"
+ },
+ stats: "summary"
+};
diff --git a/examples/template-common.js b/examples/template-common.js
index c68c5ac1d0f..2e5a9db18f5 100644
--- a/examples/template-common.js
+++ b/examples/template-common.js
@@ -60,7 +60,7 @@ exports.replaceResults = (template, baseDir, stdout, prefix) => {
const regexp = new RegExp("_\\{\\{" + (prefix ? prefix + ":" : "") + "([^:\\}]+)\\}\\}_", "g");
return template.replace(regexp, function(match) {
- match = match.substr(3 + (prefix ? prefix.length + 1 : 0), match.length - 6 - (prefix ? prefix.length + 1 : 0));
+ match = match.slice(3 + (prefix ? prefix.length + 1 : 0), -3);
if(match === "stdout")
return stdout;
try {
diff --git a/examples/top-level-await/README.md b/examples/top-level-await/README.md
index 882e3285cf5..5e8cddc5b07 100644
--- a/examples/top-level-await/README.md
+++ b/examples/top-level-await/README.md
@@ -119,25 +119,7 @@ When compiling for other targets like node.js, electron or WebWorkers, it may be
/******/ (() => { // webpackBootstrap
/******/ "use strict";
/******/ var __webpack_modules__ = ([
-/* 0 */
-/*!********************!*\
- !*** ./example.js ***!
- \********************/
-/*! namespace exports */
-/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
-/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-
-__webpack_require__.r(__webpack_exports__);
-/* harmony import */ var _Actions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Actions.js */ 1);
-
-
-(async ()=> {
- await (0,_Actions_js__WEBPACK_IMPORTED_MODULE_0__.CreateUserAction)("John");
-})();
-
-
-/***/ }),
+/* 0 */,
/* 1 */
/*!********************!*\
!*** ./Actions.js ***!
@@ -151,8 +133,8 @@ __webpack_require__.r(__webpack_exports__);
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "CreateUserAction": () => /* binding */ CreateUserAction,
-/* harmony export */ "AlternativeCreateUserAction": () => /* binding */ AlternativeCreateUserAction
+/* harmony export */ "AlternativeCreateUserAction": () => (/* binding */ AlternativeCreateUserAction),
+/* harmony export */ "CreateUserAction": () => (/* binding */ CreateUserAction)
/* harmony export */ });
// import() doesn't care about whether a module is an async module or not
const UserApi = __webpack_require__.e(/*! import() */ 497).then(__webpack_require__.bind(__webpack_require__, /*! ./UserApi.js */ 2));
@@ -197,8 +179,9 @@ const AlternativeCreateUserAction = async name => {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -218,6 +201,75 @@ const AlternativeCreateUserAction = async name => {
/******/ __webpack_require__.m = __webpack_modules__;
/******/
/************************************************************************/
+/******/ /* webpack/runtime/async module */
+/******/ (() => {
+/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__";
+/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";
+/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";
+/******/ var resolveQueue = (queue) => {
+/******/ if(queue && !queue.d) {
+/******/ queue.d = 1;
+/******/ queue.forEach((fn) => (fn.r--));
+/******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));
+/******/ }
+/******/ }
+/******/ var wrapDeps = (deps) => (deps.map((dep) => {
+/******/ if(dep !== null && typeof dep === "object") {
+/******/ if(dep[webpackQueues]) return dep;
+/******/ if(dep.then) {
+/******/ var queue = [];
+/******/ queue.d = 0;
+/******/ dep.then((r) => {
+/******/ obj[webpackExports] = r;
+/******/ resolveQueue(queue);
+/******/ }, (e) => {
+/******/ obj[webpackError] = e;
+/******/ resolveQueue(queue);
+/******/ });
+/******/ var obj = {};
+/******/ obj[webpackQueues] = (fn) => (fn(queue));
+/******/ return obj;
+/******/ }
+/******/ }
+/******/ var ret = {};
+/******/ ret[webpackQueues] = x => {};
+/******/ ret[webpackExports] = dep;
+/******/ return ret;
+/******/ }));
+/******/ __webpack_require__.a = (module, body, hasAwait) => {
+/******/ var queue;
+/******/ hasAwait && ((queue = []).d = 1);
+/******/ var depQueues = new Set();
+/******/ var exports = module.exports;
+/******/ var currentDeps;
+/******/ var outerResolve;
+/******/ var reject;
+/******/ var promise = new Promise((resolve, rej) => {
+/******/ reject = rej;
+/******/ outerResolve = resolve;
+/******/ });
+/******/ promise[webpackExports] = exports;
+/******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {}));
+/******/ module.exports = promise;
+/******/ body((deps) => {
+/******/ currentDeps = wrapDeps(deps);
+/******/ var fn;
+/******/ var getResult = () => (currentDeps.map((d) => {
+/******/ if(d[webpackError]) throw d[webpackError];
+/******/ return d[webpackExports];
+/******/ }))
+/******/ var promise = new Promise((resolve) => {
+/******/ fn = () => (resolve(getResult));
+/******/ fn.r = 0;
+/******/ var fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));
+/******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue)));
+/******/ });
+/******/ return fn.r ? promise : getResult();
+/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));
+/******/ queue && (queue.d = 0);
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
@@ -254,7 +306,7 @@ const AlternativeCreateUserAction = async name => {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/load script */
@@ -262,7 +314,7 @@ const AlternativeCreateUserAction = async name => {
/******/ var inProgress = {};
/******/ // data-webpack is not used as build has no uniqueName
/******/ // loadScript function to load a script via script tag
-/******/ __webpack_require__.l = (url, done, key) => {
+/******/ __webpack_require__.l = (url, done, key, chunkId) => {
/******/ if(inProgress[url]) { inProgress[url].push(done); return; }
/******/ var script, needAttach;
/******/ if(key !== undefined) {
@@ -292,10 +344,9 @@ const AlternativeCreateUserAction = async name => {
/******/ var doneFns = inProgress[url];
/******/ delete inProgress[url];
/******/ script.parentNode && script.parentNode.removeChild(script);
-/******/ doneFns && doneFns.forEach((fn) => fn(event));
+/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -325,12 +376,11 @@ const AlternativeCreateUserAction = async name => {
/******/
/******/ // object to store loaded and loading chunks
/******/ // undefined = chunk not loaded, null = chunk preloaded/prefetched
-/******/ // Promise = chunk loading, 0 = chunk loaded
+/******/ // [resolve, reject, Promise] = chunk loading, 0 = chunk loaded
/******/ var installedChunks = {
/******/ 179: 0
/******/ };
/******/
-/******/
/******/ __webpack_require__.f.j = (chunkId, promises) => {
/******/ // JSONP chunk loading for javascript
/******/ var installedChunkData = __webpack_require__.o(installedChunks, chunkId) ? installedChunks[chunkId] : undefined;
@@ -342,9 +392,7 @@ const AlternativeCreateUserAction = async name => {
/******/ } else {
/******/ if(true) { // all chunks have JS
/******/ // setup Promise in chunk cache
-/******/ var promise = new Promise((resolve, reject) => {
-/******/ installedChunkData = installedChunks[chunkId] = [resolve, reject];
-/******/ });
+/******/ var promise = new Promise((resolve, reject) => (installedChunkData = installedChunks[chunkId] = [resolve, reject]));
/******/ promises.push(installedChunkData[2] = promise);
/******/
/******/ // start chunk loading
@@ -366,7 +414,7 @@ const AlternativeCreateUserAction = async name => {
/******/ }
/******/ }
/******/ };
-/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId);
+/******/ __webpack_require__.l(url, loadingEnded, "chunk-" + chunkId, chunkId);
/******/ } else installedChunks[chunkId] = 0;
/******/ }
/******/ }
@@ -380,39 +428,36 @@ const AlternativeCreateUserAction = async name => {
/******/
/******/ // no HMR manifest
/******/
-/******/ // no deferred startup
+/******/ // no on chunks loaded
/******/
/******/ // install a JSONP callback for chunk loading
/******/ var webpackJsonpCallback = (parentChunkLoadingFunction, data) => {
/******/ var [chunkIds, moreModules, runtime] = data;
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
-/******/ var moduleId, chunkId, i = 0, resolves = [];
+/******/ var moduleId, chunkId, i = 0;
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
+/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
+/******/ }
+/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
-/******/ resolves.push(installedChunks[chunkId][0]);
+/******/ installedChunks[chunkId][0]();
/******/ }
/******/ installedChunks[chunkId] = 0;
/******/ }
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
-/******/ }
-/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
-/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
-/******/ while(resolves.length) {
-/******/ resolves.shift()();
-/******/ }
/******/
/******/ }
/******/
/******/ var chunkLoadingGlobal = self["webpackChunk"] = self["webpackChunk"] || [];
/******/ chunkLoadingGlobal.forEach(webpackJsonpCallback.bind(null, 0));
/******/ chunkLoadingGlobal.push = webpackJsonpCallback.bind(null, chunkLoadingGlobal.push.bind(chunkLoadingGlobal));
-/******/
-/******/ // no deferred startup
/******/ })();
/******/
/************************************************************************/
@@ -421,10 +466,25 @@ const AlternativeCreateUserAction = async name => {
``` js
-/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
-/******/ // This entry module used 'exports' so it can't be inlined
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
+(() => {
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, __webpack_require__.* */
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _Actions_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./Actions.js */ 1);
+
+
+(async ()=> {
+ await (0,_Actions_js__WEBPACK_IMPORTED_MODULE_0__.CreateUserAction)("John");
+})();
+
+})();
+
/******/ })()
;
```
@@ -432,6 +492,7 @@ const AlternativeCreateUserAction = async name => {
# dist/497.output.js
```javascript
+"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[497],[
/* 0 */,
/* 1 */,
@@ -442,17 +503,17 @@ const AlternativeCreateUserAction = async name => {
/*! namespace exports */
/*! export createUser [provided] [no usage info] [missing usage info prevents renaming] */
/*! other exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.d, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.a, __webpack_require__.d, __webpack_require__.* */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
-"use strict";
-module.exports = (async () => {
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "createUser": () => /* binding */ createUser
+/* harmony export */ "createUser": () => (/* binding */ createUser)
/* harmony export */ });
/* harmony import */ var _db_connection_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./db-connection.js */ 3);
-_db_connection_js__WEBPACK_IMPORTED_MODULE_0__ = await Promise.resolve(_db_connection_js__WEBPACK_IMPORTED_MODULE_0__);
+var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_db_connection_js__WEBPACK_IMPORTED_MODULE_0__]);
+_db_connection_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
const createUser = async name => {
@@ -461,8 +522,8 @@ const createUser = async name => {
await (0,_db_connection_js__WEBPACK_IMPORTED_MODULE_0__.dbCall)({ command });
};
-return __webpack_exports__;
-})();
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } });
/***/ }),
/* 3 */
@@ -473,15 +534,14 @@ return __webpack_exports__;
/*! export close [provided] [no usage info] [missing usage info prevents renaming] */
/*! export dbCall [provided] [no usage info] [missing usage info prevents renaming] */
/*! other exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__.r, __webpack_exports__, module, __webpack_require__.d, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__.r, __webpack_exports__, module, __webpack_require__.a, __webpack_require__.d, __webpack_require__.* */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
-"use strict";
-module.exports = (async () => {
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "dbCall": () => /* binding */ dbCall,
-/* harmony export */ "close": () => /* binding */ close
+/* harmony export */ "close": () => (/* binding */ close),
+/* harmony export */ "dbCall": () => (/* binding */ dbCall)
/* harmony export */ });
const connectToDB = async url => {
await new Promise(r => setTimeout(r, 1000));
@@ -500,8 +560,8 @@ const close = () => {
console.log("closes the DB connection");
};
-return __webpack_exports__;
-})();
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } }, 1);
/***/ })
]]);
@@ -510,7 +570,7 @@ return __webpack_exports__;
## in production mode:
```javascript
-(self.webpackChunk=self.webpackChunk||[]).push([[497],{497:(e,a,s)=>{"use strict";e.exports=(async()=>{s.r(a),s.d(a,{createUser:()=>t});var e=s(447);e=await Promise.resolve(e);const t=async a=>{command=`CREATE USER ${a}`,await(0,e.j)({command})};return a})()},447:(e,a,s)=>{"use strict";e.exports=(async()=>{s.d(a,{j:()=>e}),await(async e=>{await new Promise((e=>setTimeout(e,1e3)))})();const e=async e=>(await new Promise((e=>setTimeout(e,100))),"fake data");return a})()}}]);
+"use strict";(self.webpackChunk=self.webpackChunk||[]).push([[497],{497:(a,e,t)=>{t.a(a,(async(a,c)=>{try{t.r(e),t.d(e,{createUser:()=>m});var s=t(447),n=a([s]);s=(n.then?(await n)():n)[0];const m=async a=>{command=`CREATE USER ${a}`,await(0,s.j)({command})};c()}catch(a){c(a)}}))},447:(a,e,t)=>{t.a(a,(async(a,c)=>{try{t.d(e,{j:()=>s});const a=async a=>{await new Promise((a=>setTimeout(a,1e3)))};await a("my-sql://example.com");const s=async a=>(await new Promise((a=>setTimeout(a,100))),"fake data");c()}catch(a){c(a)}}),1)}}]);
```
# Info
@@ -518,11 +578,11 @@ return __webpack_exports__;
## Unoptimized
```
-asset output.js 12.3 KiB [emitted] (name: main)
-asset 497.output.js 2.52 KiB [emitted]
-chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 5.54 KiB (runtime) [entry] [rendered]
+asset output.js 15 KiB [emitted] (name: main)
+asset 497.output.js 2.97 KiB [emitted]
+chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 7.57 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 5.54 KiB 8 modules
+ runtime modules 7.57 KiB 9 modules
dependent modules 1.09 KiB [dependent] 1 module
./example.js 103 bytes [built] [code generated]
[no exports]
@@ -537,17 +597,17 @@ chunk (runtime: main) 497.output.js 617 bytes [rendered]
[used exports unknown]
import() ./UserApi.js ./Actions.js 2:16-38
import() ./UserApi.js ./Actions.js 22:30-52
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 2.02 KiB [emitted] [minimized] (name: main)
-asset 497.output.js 477 bytes [emitted] [minimized]
-chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 5.54 KiB (runtime) [entry] [rendered]
+asset output.js 2.94 KiB [emitted] [minimized] (name: main)
+asset 497.output.js 531 bytes [emitted] [minimized]
+chunk (runtime: main) output.js (main) 1.19 KiB (javascript) 7.57 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 5.54 KiB 8 modules
+ runtime modules 7.57 KiB 9 modules
./example.js + 1 modules 1.19 KiB [built] [code generated]
[no exports]
[no exports used]
@@ -560,5 +620,5 @@ chunk (runtime: main) 497.output.js 617 bytes [rendered]
[exports: createUser]
import() ./UserApi.js ./example.js + 1 modules ./Actions.js 2:16-38
import() ./UserApi.js ./example.js + 1 modules ./Actions.js 22:30-52
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/two-explicit-vendor-chunks/README.md b/examples/two-explicit-vendor-chunks/README.md
index 50706b0679c..7b1fa8a7a48 100644
--- a/examples/two-explicit-vendor-chunks/README.md
+++ b/examples/two-explicit-vendor-chunks/README.md
@@ -3,7 +3,7 @@
```javascript
var path = require("path");
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
vendor1: ["./vendor1"],
vendor2: ["./vendor2"],
@@ -64,8 +64,9 @@ module.exports = "Vendor1";
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -87,10 +88,12 @@ module.exports = "Vendor1";
``` js
+/******/
/******/ // startup
-/******/ // Load entry module
+/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
-/******/ __webpack_require__(0);
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/
/******/ })()
;
```
@@ -139,8 +142,9 @@ __webpack_require__(/*! ./vendor1 */ 0);
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -162,10 +166,12 @@ __webpack_require__(/*! ./vendor1 */ 0);
``` js
+/******/
/******/ // startup
-/******/ // Load entry module
+/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
-/******/ __webpack_require__(1);
+/******/ var __webpack_exports__ = __webpack_require__(1);
+/******/
/******/ })()
;
```
@@ -229,8 +235,9 @@ __webpack_require__(/*! ./vendor2 */ 1);
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -252,10 +259,12 @@ __webpack_require__(/*! ./vendor2 */ 1);
``` js
+/******/
/******/ // startup
-/******/ // Load entry module
+/******/ // Load entry module and return exports
/******/ // This entry module is referenced by other modules so it can't be inlined
-/******/ __webpack_require__(2);
+/******/ var __webpack_exports__ = __webpack_require__(2);
+/******/
/******/ })()
;
```
@@ -265,11 +274,11 @@ __webpack_require__(/*! ./vendor2 */ 1);
## Unoptimized
```
-asset pageA.js 2.33 KiB [emitted] (name: pageA)
-asset vendor2.js 1.9 KiB [emitted] (name: vendor2)
-asset vendor1.js 1.51 KiB [emitted] (name: vendor1)
-asset pageB.js 1.51 KiB [emitted] (name: pageB)
-asset pageC.js 1.51 KiB [emitted] (name: pageC)
+asset pageA.js 2.43 KiB [emitted] (name: pageA)
+asset vendor2.js 2 KiB [emitted] (name: vendor2)
+asset vendor1.js 1.61 KiB [emitted] (name: vendor1)
+asset pageB.js 1.61 KiB [emitted] (name: pageB)
+asset pageC.js 1.61 KiB [emitted] (name: pageC)
chunk (runtime: pageA) pageA.js (pageA) 147 bytes [entry] [rendered]
> ./pageA pageA
dependent modules 77 bytes [dependent] 2 modules
@@ -305,17 +314,17 @@ chunk (runtime: vendor2) vendor2.js (vendor2) 77 bytes [entry] [rendered]
cjs require ./vendor2 ./pageA.js 3:0-20
cjs self exports reference ./vendor2.js 1:0-14
entry ./vendor2 vendor2
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset pageA.js 251 bytes [emitted] [minimized] (name: pageA)
-asset vendor2.js 204 bytes [emitted] [minimized] (name: vendor2)
-asset vendor1.js 162 bytes [emitted] [minimized] (name: vendor1)
-asset pageB.js 160 bytes [emitted] [minimized] (name: pageB)
-asset pageC.js 160 bytes [emitted] [minimized] (name: pageC)
+asset pageA.js 265 bytes [emitted] [minimized] (name: pageA)
+asset vendor2.js 218 bytes [emitted] [minimized] (name: vendor2)
+asset vendor1.js 176 bytes [emitted] [minimized] (name: vendor1)
+asset pageB.js 174 bytes [emitted] [minimized] (name: pageB)
+asset pageC.js 174 bytes [emitted] [minimized] (name: pageC)
chunk (runtime: pageB) pageB.js (pageB) 25 bytes [entry] [rendered]
> ./pageB pageB
./pageB.js 25 bytes [built] [code generated]
@@ -351,5 +360,5 @@ chunk (runtime: vendor1) vendor1.js (vendor1) 27 bytes [entry] [rendered]
cjs self exports reference ./vendor1.js 1:0-14
cjs require ./vendor1 ./vendor2.js 2:0-20
entry ./vendor1 vendor1
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/two-explicit-vendor-chunks/webpack.config.js b/examples/two-explicit-vendor-chunks/webpack.config.js
index 582fdd0dbb2..f1c79238e54 100644
--- a/examples/two-explicit-vendor-chunks/webpack.config.js
+++ b/examples/two-explicit-vendor-chunks/webpack.config.js
@@ -1,6 +1,7 @@
-var path = require("path");
+const path = require("path");
+
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
entry: {
vendor1: ["./vendor1"],
vendor2: ["./vendor2"],
diff --git a/examples/typescript/README.md b/examples/typescript/README.md
index 4ea49b86dea..3412b1b9728 100644
--- a/examples/typescript/README.md
+++ b/examples/typescript/README.md
@@ -25,9 +25,6 @@ const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
module.exports = (env = "development") => ({
mode: env,
- entry: {
- output: "./index.ts"
- },
module: {
rules: [
{
@@ -58,15 +55,17 @@ module.exports = (env = "development") => ({
\******************/
/*! unknown exports (runtime-defined) */
/*! runtime requirements: top-level-this-exports */
-/*! CommonJS bailout: this is used directly at 1:22-26 */
+/*! CommonJS bailout: this is used directly at 1:21-25 */
/***/ (function() {
-var __spreadArrays = (this && this.__spreadArrays) || function () {
- for (var s = 0, i = 0, il = arguments.length; i < il; i++) s += arguments[i].length;
- for (var r = Array(s), k = 0, i = 0; i < il; i++)
- for (var a = arguments[i], j = 0, jl = a.length; j < jl; j++, k++)
- r[k] = a[j];
- return r;
+var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
+ if (ar || !(i in from)) {
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
+ ar[i] = from[i];
+ }
+ }
+ return to.concat(ar || Array.prototype.slice.call(from));
};
var myName = "Junya";
var age = 22;
@@ -75,7 +74,7 @@ function getArray() {
for (var _i = 0; _i < arguments.length; _i++) {
args[_i] = arguments[_i];
}
- return __spreadArrays(args);
+ return __spreadArray([], args, true);
}
console.log(getArray("foo", "bar"));
console.log(getArray(1, 2, 3));
@@ -95,8 +94,9 @@ console.log(getArray(1, 2, 3));
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -118,6 +118,8 @@ console.log(getArray(1, 2, 3));
``` js
+var __webpack_exports__ = {};
+// This entry need to be wrapped in an IIFE because it need to be isolated against other modules in the chunk.
(() => {
/*!********************!*\
!*** ./example.js ***!
@@ -137,25 +139,25 @@ console.log(__webpack_require__(/*! ./index */ 1));
## Unoptimized
```
-asset output.js 2.18 KiB [emitted] (name: main)
-chunk (runtime: main) output.js (main) 652 bytes [entry] [rendered]
+asset output.js 2.4 KiB [emitted] (name: main)
+chunk (runtime: main) output.js (main) 696 bytes [entry] [rendered]
> ./example.js main
- dependent modules 619 bytes [dependent] 1 module
+ dependent modules 663 bytes [dependent] 1 module
./example.js 33 bytes [built] [code generated]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset output.js 524 bytes [emitted] [minimized] (name: main)
-chunk (runtime: main) output.js (main) 652 bytes [entry] [rendered]
+asset output.js 553 bytes [emitted] [minimized] (name: main)
+chunk (runtime: main) output.js (main) 696 bytes [entry] [rendered]
> ./example.js main
- dependent modules 619 bytes [dependent] 1 module
+ dependent modules 663 bytes [dependent] 1 module
./example.js 33 bytes [built] [code generated]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/typescript/test.filter.js b/examples/typescript/test.filter.js
new file mode 100644
index 00000000000..41a5d11e5c6
--- /dev/null
+++ b/examples/typescript/test.filter.js
@@ -0,0 +1,5 @@
+var supportsOptionalChaining = require("../../test/helpers/supportsOptionalChaining");
+
+module.exports = function (config) {
+ return supportsOptionalChaining();
+};
diff --git a/examples/typescript/webpack.config.js b/examples/typescript/webpack.config.js
index e3d8ac4432d..b33a1ed24e6 100644
--- a/examples/typescript/webpack.config.js
+++ b/examples/typescript/webpack.config.js
@@ -2,9 +2,6 @@ const ForkTsCheckerWebpackPlugin = require("fork-ts-checker-webpack-plugin");
module.exports = (env = "development") => ({
mode: env,
- entry: {
- output: "./index.ts"
- },
module: {
rules: [
{
diff --git a/examples/wasm-bindgen-esm/README.md b/examples/wasm-bindgen-esm/README.md
new file mode 100644
index 00000000000..8d5e4c44a8a
--- /dev/null
+++ b/examples/wasm-bindgen-esm/README.md
@@ -0,0 +1,396 @@
+This is a simple example that shows the usage of an ES module packaging around a Rust module, built by wasm-pack.
+
+The ES module can be imported like other async modules with `import` or `import()`.
+When importing, the underlying WebAssembly module is downloaded and instantiated in a streaming way.
+
+# example.js
+
+```javascript
+import { greeting } from "./pkg";
+
+document.write(greeting('Bob'));
+```
+
+# dist/output.js
+
+```javascript
+/******/ (() => { // webpackBootstrap
+/******/ "use strict";
+/******/ var __webpack_modules__ = ([
+/* 0 */
+/*!********************!*\
+ !*** ./example.js ***!
+ \********************/
+/*! namespace exports */
+/*! exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.a, __webpack_require__.* */
+/***/ ((module, __webpack_exports__, __webpack_require__) => {
+
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
+__webpack_require__.r(__webpack_exports__);
+/* harmony import */ var _pkg__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./pkg */ 1);
+var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_pkg__WEBPACK_IMPORTED_MODULE_0__]);
+_pkg__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
+
+
+document.write((0,_pkg__WEBPACK_IMPORTED_MODULE_0__.greeting)('Bob'));
+
+
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } });
+
+/***/ }),
+/* 1 */
+/*!***************************!*\
+ !*** ./pkg/hi_wasm_bg.js ***!
+ \***************************/
+/*! namespace exports */
+/*! export greeting [provided] [no usage info] [missing usage info prevents renaming] */
+/*! other exports [not provided] [no usage info] */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.a, __webpack_require__.d, __webpack_require__.* */
+/***/ ((__webpack_module__, __webpack_exports__, __webpack_require__) => {
+
+__webpack_require__.a(__webpack_module__, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
+__webpack_require__.r(__webpack_exports__);
+/* harmony export */ __webpack_require__.d(__webpack_exports__, {
+/* harmony export */ greeting: () => (/* binding */ greeting)
+/* harmony export */ });
+/* harmony import */ var _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hi_wasm_bg.wasm */ 2);
+var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__]);
+_hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
+
+
+let WASM_VECTOR_LEN = 0;
+
+let cachegetUint8Memory0 = null;
+function getUint8Memory0() {
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {
+ cachegetUint8Memory0 = new Uint8Array(_hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer);
+ }
+ return cachegetUint8Memory0;
+}
+
+const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
+
+let cachedTextEncoder = new lTextEncoder('utf-8');
+
+const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
+ ? function (arg, view) {
+ return cachedTextEncoder.encodeInto(arg, view);
+}
+ : function (arg, view) {
+ const buf = cachedTextEncoder.encode(arg);
+ view.set(buf);
+ return {
+ read: arg.length,
+ written: buf.length
+ };
+});
+
+function passStringToWasm0(arg, malloc, realloc) {
+
+ if (realloc === undefined) {
+ const buf = cachedTextEncoder.encode(arg);
+ const ptr = malloc(buf.length);
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
+ WASM_VECTOR_LEN = buf.length;
+ return ptr;
+ }
+
+ let len = arg.length;
+ let ptr = malloc(len);
+
+ const mem = getUint8Memory0();
+
+ let offset = 0;
+
+ for (; offset < len; offset++) {
+ const code = arg.charCodeAt(offset);
+ if (code > 0x7F) break;
+ mem[ptr + offset] = code;
+ }
+
+ if (offset !== len) {
+ if (offset !== 0) {
+ arg = arg.slice(offset);
+ }
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
+ const ret = encodeString(arg, view);
+
+ offset += ret.written;
+ }
+
+ WASM_VECTOR_LEN = offset;
+ return ptr;
+}
+
+let cachegetInt32Memory0 = null;
+function getInt32Memory0() {
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer) {
+ cachegetInt32Memory0 = new Int32Array(_hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.memory.buffer);
+ }
+ return cachegetInt32Memory0;
+}
+
+const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
+
+let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
+
+cachedTextDecoder.decode();
+
+function getStringFromWasm0(ptr, len) {
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
+}
+/**
+* @param {string} name
+* @returns {string}
+*/
+function greeting(name) {
+ try {
+ const retptr = _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_add_to_stack_pointer(-16);
+ var ptr0 = passStringToWasm0(name, _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_malloc, _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_realloc);
+ var len0 = WASM_VECTOR_LEN;
+ _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.greeting(retptr, ptr0, len0);
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
+ return getStringFromWasm0(r0, r1);
+ } finally {
+ _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_add_to_stack_pointer(16);
+ _hi_wasm_bg_wasm__WEBPACK_IMPORTED_MODULE_0__.__wbindgen_free(r0, r1);
+ }
+}
+
+
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } });
+
+/***/ }),
+/* 2 */
+/*!*****************************!*\
+ !*** ./pkg/hi_wasm_bg.wasm ***!
+ \*****************************/
+/*! namespace exports */
+/*! export __wbindgen_add_to_stack_pointer [provided] [no usage info] [provision prevents renaming (no use info)] */
+/*! export __wbindgen_free [provided] [no usage info] [provision prevents renaming (no use info)] */
+/*! export __wbindgen_malloc [provided] [no usage info] [provision prevents renaming (no use info)] */
+/*! export __wbindgen_realloc [provided] [no usage info] [provision prevents renaming (no use info)] */
+/*! export greeting [provided] [no usage info] [provision prevents renaming (no use info)] */
+/*! export memory [provided] [no usage info] [provision prevents renaming (no use info)] */
+/*! other exports [not provided] [no usage info] */
+/*! runtime requirements: module, module.id, __webpack_exports__, __webpack_require__.v, __webpack_require__.* */
+/***/ ((module, exports, __webpack_require__) => {
+
+module.exports = __webpack_require__.v(exports, module.id, "ffe21e855d11d22ab54f");
+
+/***/ })
+/******/ ]);
+```
+
+/* webpack runtime code */
+
+``` js
+/************************************************************************/
+/******/ // The module cache
+/******/ var __webpack_module_cache__ = {};
+/******/
+/******/ // The require function
+/******/ function __webpack_require__(moduleId) {
+/******/ // Check if module is in cache
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
+/******/ }
+/******/ // Create a new module (and put it into the cache)
+/******/ var module = __webpack_module_cache__[moduleId] = {
+/******/ id: moduleId,
+/******/ // no module.loaded needed
+/******/ exports: {}
+/******/ };
+/******/
+/******/ // Execute the module function
+/******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__);
+/******/
+/******/ // Return the exports of the module
+/******/ return module.exports;
+/******/ }
+/******/
+/************************************************************************/
+/******/ /* webpack/runtime/async module */
+/******/ (() => {
+/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__";
+/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";
+/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";
+/******/ var resolveQueue = (queue) => {
+/******/ if(queue && queue.d < 1) {
+/******/ queue.d = 1;
+/******/ queue.forEach((fn) => (fn.r--));
+/******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));
+/******/ }
+/******/ }
+/******/ var wrapDeps = (deps) => (deps.map((dep) => {
+/******/ if(dep !== null && typeof dep === "object") {
+/******/ if(dep[webpackQueues]) return dep;
+/******/ if(dep.then) {
+/******/ var queue = [];
+/******/ queue.d = 0;
+/******/ dep.then((r) => {
+/******/ obj[webpackExports] = r;
+/******/ resolveQueue(queue);
+/******/ }, (e) => {
+/******/ obj[webpackError] = e;
+/******/ resolveQueue(queue);
+/******/ });
+/******/ var obj = {};
+/******/ obj[webpackQueues] = (fn) => (fn(queue));
+/******/ return obj;
+/******/ }
+/******/ }
+/******/ var ret = {};
+/******/ ret[webpackQueues] = x => {};
+/******/ ret[webpackExports] = dep;
+/******/ return ret;
+/******/ }));
+/******/ __webpack_require__.a = (module, body, hasAwait) => {
+/******/ var queue;
+/******/ hasAwait && ((queue = []).d = -1);
+/******/ var depQueues = new Set();
+/******/ var exports = module.exports;
+/******/ var currentDeps;
+/******/ var outerResolve;
+/******/ var reject;
+/******/ var promise = new Promise((resolve, rej) => {
+/******/ reject = rej;
+/******/ outerResolve = resolve;
+/******/ });
+/******/ promise[webpackExports] = exports;
+/******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {}));
+/******/ module.exports = promise;
+/******/ body((deps) => {
+/******/ currentDeps = wrapDeps(deps);
+/******/ var fn;
+/******/ var getResult = () => (currentDeps.map((d) => {
+/******/ if(d[webpackError]) throw d[webpackError];
+/******/ return d[webpackExports];
+/******/ }))
+/******/ var promise = new Promise((resolve) => {
+/******/ fn = () => (resolve(getResult));
+/******/ fn.r = 0;
+/******/ var fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));
+/******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue)));
+/******/ });
+/******/ return fn.r ? promise : getResult();
+/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));
+/******/ queue && queue.d < 0 && (queue.d = 0);
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/define property getters */
+/******/ (() => {
+/******/ // define getter functions for harmony exports
+/******/ __webpack_require__.d = (exports, definition) => {
+/******/ for(var key in definition) {
+/******/ if(__webpack_require__.o(definition, key) && !__webpack_require__.o(exports, key)) {
+/******/ Object.defineProperty(exports, key, { enumerable: true, get: definition[key] });
+/******/ }
+/******/ }
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/hasOwnProperty shorthand */
+/******/ (() => {
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
+/******/ })();
+/******/
+/******/ /* webpack/runtime/make namespace object */
+/******/ (() => {
+/******/ // define __esModule on exports
+/******/ __webpack_require__.r = (exports) => {
+/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
+/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
+/******/ }
+/******/ Object.defineProperty(exports, '__esModule', { value: true });
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/wasm loading */
+/******/ (() => {
+/******/ __webpack_require__.v = (exports, wasmModuleId, wasmModuleHash, importsObj) => {
+/******/ var req = fetch(__webpack_require__.p + "" + wasmModuleHash + ".wasm");
+/******/ var fallback = () => (req
+/******/ .then((x) => (x.arrayBuffer()))
+/******/ .then((bytes) => (WebAssembly.instantiate(bytes, importsObj)))
+/******/ .then((res) => (Object.assign(exports, res.instance.exports))));
+/******/ return req.then((res) => {
+/******/ if (typeof WebAssembly.instantiateStreaming === "function") {
+/******/ return WebAssembly.instantiateStreaming(res, importsObj)
+/******/ .then(
+/******/ (res) => (Object.assign(exports, res.instance.exports)),
+/******/ (e) => {
+/******/ if(res.headers.get("Content-Type") !== "application/wasm") {
+/******/ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
+/******/ return fallback();
+/******/ }
+/******/ throw e;
+/******/ }
+/******/ );
+/******/ }
+/******/ return fallback();
+/******/ });
+/******/ };
+/******/ })();
+/******/
+/******/ /* webpack/runtime/publicPath */
+/******/ (() => {
+/******/ __webpack_require__.p = "dist/";
+/******/ })();
+/******/
+/************************************************************************/
+```
+
+
+
+``` js
+/******/
+/******/ // startup
+/******/ // Load entry module and return exports
+/******/ // This entry module used 'module' so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/
+/******/ })()
+;
+```
+
+# Info
+
+## Unoptimized
+
+```
+asset ffe21e855d11d22ab54f.wasm 14.8 KiB [emitted] [immutable] (auxiliary name: main)
+asset output.js 13.4 KiB [emitted] (name: main)
+chunk (runtime: main) output.js (main) 3.03 KiB (javascript) 14.8 KiB (webassembly) 3.68 KiB (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 3.68 KiB 6 modules
+ dependent modules 2.97 KiB (javascript) 14.8 KiB (webassembly) [dependent] 2 modules
+ ./example.js 69 bytes [built] [code generated]
+ [no exports]
+ [used exports unknown]
+ entry ./example.js main
+webpack 5.90.0 compiled successfully
+```
+
+## Production mode
+
+```
+asset f7199313c1125f249cd6.wasm 14.8 KiB [emitted] [immutable] (auxiliary name: main)
+asset output.js 3.41 KiB [emitted] [minimized] (name: main)
+chunk (runtime: main) output.js (main) 3.03 KiB (javascript) 14.8 KiB (webassembly) 3.42 KiB (runtime) [entry] [rendered]
+ > ./example.js main
+ runtime modules 3.42 KiB 5 modules
+ dependent modules 2.97 KiB (javascript) 14.8 KiB (webassembly) [dependent] 2 modules
+ ./example.js 69 bytes [built] [code generated]
+ [no exports]
+ [no exports used]
+ entry ./example.js main
+webpack 5.90.0 compiled successfully
+```
diff --git a/examples/wasm-bindgen-esm/build.js b/examples/wasm-bindgen-esm/build.js
new file mode 100644
index 00000000000..41c29c9d169
--- /dev/null
+++ b/examples/wasm-bindgen-esm/build.js
@@ -0,0 +1 @@
+require("../build-common");
\ No newline at end of file
diff --git a/examples/wasm-bindgen-esm/example.js b/examples/wasm-bindgen-esm/example.js
new file mode 100644
index 00000000000..f823d275465
--- /dev/null
+++ b/examples/wasm-bindgen-esm/example.js
@@ -0,0 +1,4 @@
+import { greeting } from "./pkg";
+
+document.write(greeting('Bob'));
+
diff --git a/examples/wasm-bindgen-esm/index.html b/examples/wasm-bindgen-esm/index.html
new file mode 100644
index 00000000000..d1fb49339c9
--- /dev/null
+++ b/examples/wasm-bindgen-esm/index.html
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/examples/wasm-bindgen-esm/pkg/hi_wasm.d.ts b/examples/wasm-bindgen-esm/pkg/hi_wasm.d.ts
new file mode 100644
index 00000000000..51bb2718d6d
--- /dev/null
+++ b/examples/wasm-bindgen-esm/pkg/hi_wasm.d.ts
@@ -0,0 +1,7 @@
+/* tslint:disable */
+/* eslint-disable */
+/**
+* @param {string} name
+* @returns {string}
+*/
+export function greeting(name: string): string;
diff --git a/examples/wasm-bindgen-esm/pkg/hi_wasm.js b/examples/wasm-bindgen-esm/pkg/hi_wasm.js
new file mode 100644
index 00000000000..ae789f18707
--- /dev/null
+++ b/examples/wasm-bindgen-esm/pkg/hi_wasm.js
@@ -0,0 +1,2 @@
+import * as wasm from "./hi_wasm_bg.wasm";
+export * from "./hi_wasm_bg.js";
\ No newline at end of file
diff --git a/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.js b/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.js
new file mode 100644
index 00000000000..71aef983bfc
--- /dev/null
+++ b/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.js
@@ -0,0 +1,103 @@
+import * as wasm from './hi_wasm_bg.wasm';
+
+let WASM_VECTOR_LEN = 0;
+
+let cachegetUint8Memory0 = null;
+function getUint8Memory0() {
+ if (cachegetUint8Memory0 === null || cachegetUint8Memory0.buffer !== wasm.memory.buffer) {
+ cachegetUint8Memory0 = new Uint8Array(wasm.memory.buffer);
+ }
+ return cachegetUint8Memory0;
+}
+
+const lTextEncoder = typeof TextEncoder === 'undefined' ? (0, module.require)('util').TextEncoder : TextEncoder;
+
+let cachedTextEncoder = new lTextEncoder('utf-8');
+
+const encodeString = (typeof cachedTextEncoder.encodeInto === 'function'
+ ? function (arg, view) {
+ return cachedTextEncoder.encodeInto(arg, view);
+}
+ : function (arg, view) {
+ const buf = cachedTextEncoder.encode(arg);
+ view.set(buf);
+ return {
+ read: arg.length,
+ written: buf.length
+ };
+});
+
+function passStringToWasm0(arg, malloc, realloc) {
+
+ if (realloc === undefined) {
+ const buf = cachedTextEncoder.encode(arg);
+ const ptr = malloc(buf.length);
+ getUint8Memory0().subarray(ptr, ptr + buf.length).set(buf);
+ WASM_VECTOR_LEN = buf.length;
+ return ptr;
+ }
+
+ let len = arg.length;
+ let ptr = malloc(len);
+
+ const mem = getUint8Memory0();
+
+ let offset = 0;
+
+ for (; offset < len; offset++) {
+ const code = arg.charCodeAt(offset);
+ if (code > 0x7F) break;
+ mem[ptr + offset] = code;
+ }
+
+ if (offset !== len) {
+ if (offset !== 0) {
+ arg = arg.slice(offset);
+ }
+ ptr = realloc(ptr, len, len = offset + arg.length * 3);
+ const view = getUint8Memory0().subarray(ptr + offset, ptr + len);
+ const ret = encodeString(arg, view);
+
+ offset += ret.written;
+ }
+
+ WASM_VECTOR_LEN = offset;
+ return ptr;
+}
+
+let cachegetInt32Memory0 = null;
+function getInt32Memory0() {
+ if (cachegetInt32Memory0 === null || cachegetInt32Memory0.buffer !== wasm.memory.buffer) {
+ cachegetInt32Memory0 = new Int32Array(wasm.memory.buffer);
+ }
+ return cachegetInt32Memory0;
+}
+
+const lTextDecoder = typeof TextDecoder === 'undefined' ? (0, module.require)('util').TextDecoder : TextDecoder;
+
+let cachedTextDecoder = new lTextDecoder('utf-8', { ignoreBOM: true, fatal: true });
+
+cachedTextDecoder.decode();
+
+function getStringFromWasm0(ptr, len) {
+ return cachedTextDecoder.decode(getUint8Memory0().subarray(ptr, ptr + len));
+}
+/**
+* @param {string} name
+* @returns {string}
+*/
+export function greeting(name) {
+ try {
+ const retptr = wasm.__wbindgen_add_to_stack_pointer(-16);
+ var ptr0 = passStringToWasm0(name, wasm.__wbindgen_malloc, wasm.__wbindgen_realloc);
+ var len0 = WASM_VECTOR_LEN;
+ wasm.greeting(retptr, ptr0, len0);
+ var r0 = getInt32Memory0()[retptr / 4 + 0];
+ var r1 = getInt32Memory0()[retptr / 4 + 1];
+ return getStringFromWasm0(r0, r1);
+ } finally {
+ wasm.__wbindgen_add_to_stack_pointer(16);
+ wasm.__wbindgen_free(r0, r1);
+ }
+}
+
diff --git a/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.wasm b/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.wasm
new file mode 100644
index 00000000000..8f5af1057b5
Binary files /dev/null and b/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.wasm differ
diff --git a/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.wasm.d.ts b/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.wasm.d.ts
new file mode 100644
index 00000000000..d430adaa653
--- /dev/null
+++ b/examples/wasm-bindgen-esm/pkg/hi_wasm_bg.wasm.d.ts
@@ -0,0 +1,8 @@
+/* tslint:disable */
+/* eslint-disable */
+export const memory: WebAssembly.Memory;
+export function greeting(a: number, b: number, c: number): void;
+export function __wbindgen_add_to_stack_pointer(a: number): number;
+export function __wbindgen_malloc(a: number): number;
+export function __wbindgen_realloc(a: number, b: number, c: number): number;
+export function __wbindgen_free(a: number, b: number): void;
diff --git a/examples/wasm-bindgen-esm/pkg/package.json b/examples/wasm-bindgen-esm/pkg/package.json
new file mode 100644
index 00000000000..abdb287b0be
--- /dev/null
+++ b/examples/wasm-bindgen-esm/pkg/package.json
@@ -0,0 +1,14 @@
+{
+ "name": "hi-wasm",
+ "type": "module",
+ "version": "0.1.0",
+ "files": [
+ "hi_wasm_bg.wasm",
+ "hi_wasm.js",
+ "hi_wasm_bg.js",
+ "hi_wasm.d.ts"
+ ],
+ "main": "hi_wasm.js",
+ "types": "hi_wasm.d.ts",
+ "sideEffects": false
+}
diff --git a/examples/wasm-bindgen-esm/template.md b/examples/wasm-bindgen-esm/template.md
new file mode 100644
index 00000000000..3b1314621b1
--- /dev/null
+++ b/examples/wasm-bindgen-esm/template.md
@@ -0,0 +1,30 @@
+This is a simple example that shows the usage of an ES module packaging around a Rust module, built by wasm-pack.
+
+The ES module can be imported like other async modules with `import` or `import()`.
+When importing, the underlying WebAssembly module is downloaded and instantiated in a streaming way.
+
+# example.js
+
+```javascript
+_{{example.js}}_
+```
+
+# dist/output.js
+
+```javascript
+_{{dist/output.js}}_
+```
+
+# Info
+
+## Unoptimized
+
+```
+_{{stdout}}_
+```
+
+## Production mode
+
+```
+_{{production:stdout}}_
+```
diff --git a/examples/wasm-bindgen-esm/test.filter.js b/examples/wasm-bindgen-esm/test.filter.js
new file mode 100644
index 00000000000..9872d9c87dd
--- /dev/null
+++ b/examples/wasm-bindgen-esm/test.filter.js
@@ -0,0 +1,5 @@
+var supportsWebAssembly = require("../../test/helpers/supportsWebAssembly");
+
+module.exports = function(config) {
+ return supportsWebAssembly();
+};
diff --git a/examples/wasm-bindgen-esm/webpack.config.js b/examples/wasm-bindgen-esm/webpack.config.js
new file mode 100644
index 00000000000..70ba131d8c3
--- /dev/null
+++ b/examples/wasm-bindgen-esm/webpack.config.js
@@ -0,0 +1,21 @@
+module.exports = {
+ // mode: "development || "production",
+ output: {
+ webassemblyModuleFilename: "[hash].wasm",
+ publicPath: "dist/"
+ },
+ module: {
+ rules: [
+ {
+ test: /\.wasm$/,
+ type: "webassembly/async"
+ }
+ ]
+ },
+ optimization: {
+ chunkIds: "deterministic" // To keep filename consistent between different modes (for example building only)
+ },
+ experiments: {
+ asyncWebAssembly: true
+ }
+};
diff --git a/examples/wasm-complex/README.md b/examples/wasm-complex/README.md
index c492fa4d248..1ee4a1db3d9 100644
--- a/examples/wasm-complex/README.md
+++ b/examples/wasm-complex/README.md
@@ -79,13 +79,14 @@ export const memory = await getMemoryFromParentInWorker();
\********************/
/*! namespace exports */
/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.a, __webpack_require__.* */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
-module.exports = (async () => {
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _magic_js__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./magic.js */ 1);
-_magic_js__WEBPACK_IMPORTED_MODULE_0__ = await Promise.resolve(_magic_js__WEBPACK_IMPORTED_MODULE_0__);
+var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_magic_js__WEBPACK_IMPORTED_MODULE_0__]);
+_magic_js__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
// accessing memory
@@ -100,8 +101,8 @@ console.log((0,_magic_js__WEBPACK_IMPORTED_MODULE_0__.getNumber)());
console.log((0,_magic_js__WEBPACK_IMPORTED_MODULE_0__.getNumber)());
console.log((0,_magic_js__WEBPACK_IMPORTED_MODULE_0__.getNumber)());
-return __webpack_exports__;
-})();
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } });
/***/ }),
/* 1 */
@@ -113,23 +114,24 @@ return __webpack_exports__;
/*! export getNumber [provided] [no usage info] [missing usage info prevents renaming] -> ./magic.wat .getNumber */
/*! export set [provided] [no usage info] [missing usage info prevents renaming] -> ./magic.wat .set */
/*! other exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, module, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, module, __webpack_require__.a, __webpack_require__.* */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
-module.exports = (async () => {
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "get": () => /* reexport safe */ _magic_wat__WEBPACK_IMPORTED_MODULE_0__.get,
-/* harmony export */ "getNumber": () => /* reexport safe */ _magic_wat__WEBPACK_IMPORTED_MODULE_0__.getNumber,
-/* harmony export */ "set": () => /* reexport safe */ _magic_wat__WEBPACK_IMPORTED_MODULE_0__.set
+/* harmony export */ get: () => (/* reexport safe */ _magic_wat__WEBPACK_IMPORTED_MODULE_0__.get),
+/* harmony export */ getNumber: () => (/* reexport safe */ _magic_wat__WEBPACK_IMPORTED_MODULE_0__.getNumber),
+/* harmony export */ set: () => (/* reexport safe */ _magic_wat__WEBPACK_IMPORTED_MODULE_0__.set)
/* harmony export */ });
/* harmony import */ var _magic_wat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./magic.wat */ 2);
-_magic_wat__WEBPACK_IMPORTED_MODULE_0__ = await Promise.resolve(_magic_wat__WEBPACK_IMPORTED_MODULE_0__);
+var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_magic_wat__WEBPACK_IMPORTED_MODULE_0__]);
+_magic_wat__WEBPACK_IMPORTED_MODULE_0__ = (__webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__)[0];
// reexporting
-return __webpack_exports__;
-})();
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } });
/***/ }),
/* 2 */
@@ -141,13 +143,11 @@ return __webpack_exports__;
/*! export getNumber [provided] [no usage info] [provision prevents renaming (no use info)] */
/*! export set [provided] [no usage info] [provision prevents renaming (no use info)] */
/*! other exports [not provided] [no usage info] */
-/*! runtime requirements: module, module.id, __webpack_exports__, __webpack_require__.v, __webpack_require__, __webpack_require__.* */
+/*! runtime requirements: module, module.id, __webpack_exports__, __webpack_require__.v, __webpack_require__, __webpack_require__.a, __webpack_require__.* */
/***/ ((module, exports, __webpack_require__) => {
-/* harmony import */ var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__(/*! ./memory.js */ 3);
-/* harmony import */ var WEBPACK_IMPORTED_MODULE_1 = __webpack_require__(/*! ./magic-number.js */ 4);
-module.exports = Promise.resolve(WEBPACK_IMPORTED_MODULE_0).then((WEBPACK_IMPORTED_MODULE_0) => {
- return __webpack_require__.v(exports, module.id, "1b1e6d7ce8287ca318ae", {
+var __webpack_instantiate__ = ([WEBPACK_IMPORTED_MODULE_0]) => {
+ return __webpack_require__.v(exports, module.id, "daa529a2a650ee3943a9", {
"./memory.js": {
"memory": WEBPACK_IMPORTED_MODULE_0.memory
},
@@ -155,7 +155,24 @@ module.exports = Promise.resolve(WEBPACK_IMPORTED_MODULE_0).then((WEBPACK_IMPORT
"getRandomNumber": WEBPACK_IMPORTED_MODULE_1.getRandomNumber
}
});
-})
+}
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => {
+ try {
+ /* harmony import */ var WEBPACK_IMPORTED_MODULE_0 = __webpack_require__(/*! ./memory.js */ 3);
+ /* harmony import */ var WEBPACK_IMPORTED_MODULE_1 = __webpack_require__(/*! ./magic-number.js */ 4);
+ var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([WEBPACK_IMPORTED_MODULE_0]);
+ var [WEBPACK_IMPORTED_MODULE_0] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__;
+ await __webpack_require__.v(exports, module.id, "daa529a2a650ee3943a9", {
+ "./memory.js": {
+ "memory": WEBPACK_IMPORTED_MODULE_0.memory
+ },
+ "./magic-number.js": {
+ "getRandomNumber": WEBPACK_IMPORTED_MODULE_1.getRandomNumber
+ }
+ });
+ __webpack_async_result__();
+ } catch(e) { __webpack_async_result__(e); }
+}, 1);
/***/ }),
/* 3 */
@@ -165,13 +182,13 @@ module.exports = Promise.resolve(WEBPACK_IMPORTED_MODULE_0).then((WEBPACK_IMPORT
/*! namespace exports */
/*! export memory [provided] [no usage info] [missing usage info prevents renaming] */
/*! other exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__.r, __webpack_exports__, module, __webpack_require__.d, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__.r, __webpack_exports__, module, __webpack_require__.a, __webpack_require__.d, __webpack_require__.* */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
-module.exports = (async () => {
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "memory": () => /* binding */ memory
+/* harmony export */ memory: () => (/* binding */ memory)
/* harmony export */ });
async function getMemoryFromParentInWorker() {
await new Promise(r => setTimeout(r, 200));
@@ -181,8 +198,8 @@ async function getMemoryFromParentInWorker() {
const memory = await getMemoryFromParentInWorker();
-return __webpack_exports__;
-})();
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } }, 1);
/***/ }),
/* 4 */
@@ -198,8 +215,8 @@ return __webpack_exports__;
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "getNumber": () => /* binding */ getNumber,
-/* harmony export */ "getRandomNumber": () => /* binding */ getRandomNumber
+/* harmony export */ getNumber: () => (/* binding */ getNumber),
+/* harmony export */ getRandomNumber: () => (/* binding */ getRandomNumber)
/* harmony export */ });
function getNumber() {
return 42;
@@ -224,8 +241,9 @@ function getRandomNumber() {
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -242,6 +260,75 @@ function getRandomNumber() {
/******/ }
/******/
/************************************************************************/
+/******/ /* webpack/runtime/async module */
+/******/ (() => {
+/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__";
+/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";
+/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";
+/******/ var resolveQueue = (queue) => {
+/******/ if(queue && queue.d < 1) {
+/******/ queue.d = 1;
+/******/ queue.forEach((fn) => (fn.r--));
+/******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));
+/******/ }
+/******/ }
+/******/ var wrapDeps = (deps) => (deps.map((dep) => {
+/******/ if(dep !== null && typeof dep === "object") {
+/******/ if(dep[webpackQueues]) return dep;
+/******/ if(dep.then) {
+/******/ var queue = [];
+/******/ queue.d = 0;
+/******/ dep.then((r) => {
+/******/ obj[webpackExports] = r;
+/******/ resolveQueue(queue);
+/******/ }, (e) => {
+/******/ obj[webpackError] = e;
+/******/ resolveQueue(queue);
+/******/ });
+/******/ var obj = {};
+/******/ obj[webpackQueues] = (fn) => (fn(queue));
+/******/ return obj;
+/******/ }
+/******/ }
+/******/ var ret = {};
+/******/ ret[webpackQueues] = x => {};
+/******/ ret[webpackExports] = dep;
+/******/ return ret;
+/******/ }));
+/******/ __webpack_require__.a = (module, body, hasAwait) => {
+/******/ var queue;
+/******/ hasAwait && ((queue = []).d = -1);
+/******/ var depQueues = new Set();
+/******/ var exports = module.exports;
+/******/ var currentDeps;
+/******/ var outerResolve;
+/******/ var reject;
+/******/ var promise = new Promise((resolve, rej) => {
+/******/ reject = rej;
+/******/ outerResolve = resolve;
+/******/ });
+/******/ promise[webpackExports] = exports;
+/******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {}));
+/******/ module.exports = promise;
+/******/ body((deps) => {
+/******/ currentDeps = wrapDeps(deps);
+/******/ var fn;
+/******/ var getResult = () => (currentDeps.map((d) => {
+/******/ if(d[webpackError]) throw d[webpackError];
+/******/ return d[webpackExports];
+/******/ }))
+/******/ var promise = new Promise((resolve) => {
+/******/ fn = () => (resolve(getResult));
+/******/ fn.r = 0;
+/******/ var fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));
+/******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue)));
+/******/ });
+/******/ return fn.r ? promise : getResult();
+/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));
+/******/ queue && queue.d < 0 && (queue.d = 0);
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
@@ -256,7 +343,7 @@ function getRandomNumber() {
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
@@ -270,36 +357,50 @@ function getRandomNumber() {
/******/ };
/******/ })();
/******/
-/******/ /* webpack/runtime/publicPath */
-/******/ (() => {
-/******/ __webpack_require__.p = "dist/";
-/******/ })();
-/******/
-/******/ /* webpack/runtime/wasm chunk loading */
+/******/ /* webpack/runtime/wasm loading */
/******/ (() => {
/******/ __webpack_require__.v = (exports, wasmModuleId, wasmModuleHash, importsObj) => {
/******/ var req = fetch(__webpack_require__.p + "" + wasmModuleHash + ".module.wasm");
-/******/ if (typeof WebAssembly.instantiateStreaming === 'function') {
-/******/ return WebAssembly.instantiateStreaming(req, importsObj)
-/******/ .then((res) => Object.assign(exports, res.instance.exports));
-/******/ }
-/******/ return req
-/******/ .then((x) => x.arrayBuffer())
-/******/ .then((bytes) => WebAssembly.instantiate(bytes, importsObj))
-/******/ .then((res) => Object.assign(exports, res.instance.exports));
+/******/ var fallback = () => (req
+/******/ .then((x) => (x.arrayBuffer()))
+/******/ .then((bytes) => (WebAssembly.instantiate(bytes, importsObj)))
+/******/ .then((res) => (Object.assign(exports, res.instance.exports))));
+/******/ return req.then((res) => {
+/******/ if (typeof WebAssembly.instantiateStreaming === "function") {
+/******/ return WebAssembly.instantiateStreaming(res, importsObj)
+/******/ .then(
+/******/ (res) => (Object.assign(exports, res.instance.exports)),
+/******/ (e) => {
+/******/ if(res.headers.get("Content-Type") !== "application/wasm") {
+/******/ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
+/******/ return fallback();
+/******/ }
+/******/ throw e;
+/******/ }
+/******/ );
+/******/ }
+/******/ return fallback();
+/******/ });
/******/ };
/******/ })();
/******/
+/******/ /* webpack/runtime/publicPath */
+/******/ (() => {
+/******/ __webpack_require__.p = "dist/";
+/******/ })();
+/******/
/************************************************************************/
```
``` js
+/******/
/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
+/******/ // Load entry module and return exports
/******/ // This entry module used 'module' so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/
/******/ })()
;
```
@@ -309,31 +410,31 @@ function getRandomNumber() {
## Unoptimized
```
-asset output.js 8.87 KiB [emitted] (name: main)
-asset 1b1e6d7ce8287ca318ae.module.wasm 139 bytes [emitted] [immutable] (auxiliary name: main)
-chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 1.2 KiB (runtime) [entry] [rendered]
+asset output.js 13.8 KiB [emitted] (name: main)
+asset daa529a2a650ee3943a9.module.wasm 139 bytes [emitted] [immutable] (auxiliary name: main)
+chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 3.69 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 1.2 KiB 5 modules
+ runtime modules 3.69 KiB 6 modules
dependent modules 449 bytes (javascript) 139 bytes (webassembly) [dependent] 4 modules
./example.js 247 bytes [built] [code generated]
[no exports]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.90.0 compiled successfully
```
## Production mode
```
-asset output.js 1.44 KiB [emitted] [minimized] (name: main)
-asset f5764885c32853f144a2.module.wasm 139 bytes [emitted] [immutable] (auxiliary name: main)
-chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 950 bytes (runtime) [entry] [rendered]
+asset output.js 2.81 KiB [emitted] [minimized] (name: main)
+asset 05aa07f6a3836ded50d1.module.wasm 139 bytes [emitted] [immutable] (auxiliary name: main)
+chunk (runtime: main) output.js (main) 696 bytes (javascript) 139 bytes (webassembly) 3.42 KiB (runtime) [entry] [rendered]
> ./example.js main
+ runtime modules 3.42 KiB 5 modules
dependent modules 449 bytes (javascript) 139 bytes (webassembly) [dependent] 4 modules
- runtime modules 950 bytes 4 modules
./example.js 247 bytes [built] [code generated]
[no exports]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.90.0 compiled successfully
```
diff --git a/examples/wasm-complex/webpack.config.js b/examples/wasm-complex/webpack.config.js
index ee188b60683..13de5cdac2f 100644
--- a/examples/wasm-complex/webpack.config.js
+++ b/examples/wasm-complex/webpack.config.js
@@ -1,5 +1,5 @@
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
output: {
publicPath: "dist/"
},
diff --git a/examples/wasm-simple/README.md b/examples/wasm-simple/README.md
index f373060b254..38a49528e1f 100644
--- a/examples/wasm-simple/README.md
+++ b/examples/wasm-simple/README.md
@@ -68,14 +68,15 @@ export function fibonacciJavascript(i) {
\********************/
/*! namespace exports */
/*! exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__, __webpack_require__.r, __webpack_exports__, module, __webpack_require__.a, __webpack_require__.* */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
-module.exports = (async () => {
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony import */ var _add_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./add.wasm */ 1);
/* harmony import */ var _math__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./math */ 2);
-([_math__WEBPACK_IMPORTED_MODULE_1__, _add_wasm__WEBPACK_IMPORTED_MODULE_0__] = await Promise.all([_math__WEBPACK_IMPORTED_MODULE_1__, _add_wasm__WEBPACK_IMPORTED_MODULE_0__]));
+var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_add_wasm__WEBPACK_IMPORTED_MODULE_0__, _math__WEBPACK_IMPORTED_MODULE_1__]);
+([_add_wasm__WEBPACK_IMPORTED_MODULE_0__, _math__WEBPACK_IMPORTED_MODULE_1__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
@@ -99,8 +100,8 @@ function timed(name, fn) {
console.timeEnd(name);
}
-return __webpack_exports__;
-})();
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } });
/***/ }),
/* 1 */
@@ -113,7 +114,7 @@ return __webpack_exports__;
/*! runtime requirements: module, module.id, __webpack_exports__, __webpack_require__.v, __webpack_require__.* */
/***/ ((module, exports, __webpack_require__) => {
-module.exports = __webpack_require__.v(exports, module.id, "a7a690138d8dd16930b3")
+module.exports = __webpack_require__.v(exports, module.id, "0eaeab8b9fa3cef100d1");
/***/ }),
/* 2 */
@@ -127,22 +128,23 @@ module.exports = __webpack_require__.v(exports, module.id, "a7a690138d8dd16930b3
/*! export fibonacci [provided] [no usage info] [missing usage info prevents renaming] -> ./fibonacci.wasm .fibonacci */
/*! export fibonacciJavascript [provided] [no usage info] [missing usage info prevents renaming] */
/*! other exports [not provided] [no usage info] */
-/*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, module, __webpack_require__.* */
+/*! runtime requirements: __webpack_require__, __webpack_exports__, __webpack_require__.d, __webpack_require__.r, module, __webpack_require__.a, __webpack_require__.* */
/***/ ((module, __webpack_exports__, __webpack_require__) => {
-module.exports = (async () => {
+__webpack_require__.a(module, async (__webpack_handle_async_dependencies__, __webpack_async_result__) => { try {
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
-/* harmony export */ "add": () => /* reexport safe */ _add_wasm__WEBPACK_IMPORTED_MODULE_0__.add,
-/* harmony export */ "factorial": () => /* reexport safe */ _factorial_wasm__WEBPACK_IMPORTED_MODULE_1__.factorial,
-/* harmony export */ "fibonacci": () => /* reexport safe */ _fibonacci_wasm__WEBPACK_IMPORTED_MODULE_2__.fibonacci,
-/* harmony export */ "factorialJavascript": () => /* binding */ factorialJavascript,
-/* harmony export */ "fibonacciJavascript": () => /* binding */ fibonacciJavascript
+/* harmony export */ add: () => (/* reexport safe */ _add_wasm__WEBPACK_IMPORTED_MODULE_0__.add),
+/* harmony export */ factorial: () => (/* reexport safe */ _factorial_wasm__WEBPACK_IMPORTED_MODULE_1__.factorial),
+/* harmony export */ factorialJavascript: () => (/* binding */ factorialJavascript),
+/* harmony export */ fibonacci: () => (/* reexport safe */ _fibonacci_wasm__WEBPACK_IMPORTED_MODULE_2__.fibonacci),
+/* harmony export */ fibonacciJavascript: () => (/* binding */ fibonacciJavascript)
/* harmony export */ });
/* harmony import */ var _add_wasm__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./add.wasm */ 1);
/* harmony import */ var _factorial_wasm__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./factorial.wasm */ 3);
/* harmony import */ var _fibonacci_wasm__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fibonacci.wasm */ 4);
-([_fibonacci_wasm__WEBPACK_IMPORTED_MODULE_2__, _factorial_wasm__WEBPACK_IMPORTED_MODULE_1__, _add_wasm__WEBPACK_IMPORTED_MODULE_0__] = await Promise.all([_fibonacci_wasm__WEBPACK_IMPORTED_MODULE_2__, _factorial_wasm__WEBPACK_IMPORTED_MODULE_1__, _add_wasm__WEBPACK_IMPORTED_MODULE_0__]));
+var __webpack_async_dependencies__ = __webpack_handle_async_dependencies__([_add_wasm__WEBPACK_IMPORTED_MODULE_0__, _factorial_wasm__WEBPACK_IMPORTED_MODULE_1__, _fibonacci_wasm__WEBPACK_IMPORTED_MODULE_2__]);
+([_add_wasm__WEBPACK_IMPORTED_MODULE_0__, _factorial_wasm__WEBPACK_IMPORTED_MODULE_1__, _fibonacci_wasm__WEBPACK_IMPORTED_MODULE_2__] = __webpack_async_dependencies__.then ? (await __webpack_async_dependencies__)() : __webpack_async_dependencies__);
@@ -159,8 +161,8 @@ function fibonacciJavascript(i) {
return fibonacciJavascript(i - 1) + fibonacciJavascript(i - 2);
}
-return __webpack_exports__;
-})();
+__webpack_async_result__();
+} catch(e) { __webpack_async_result__(e); } });
/***/ }),
/* 3 */
@@ -173,7 +175,7 @@ return __webpack_exports__;
/*! runtime requirements: module, module.id, __webpack_exports__, __webpack_require__.v, __webpack_require__.* */
/***/ ((module, exports, __webpack_require__) => {
-module.exports = __webpack_require__.v(exports, module.id, "9d2b0c46ef31acbcf414")
+module.exports = __webpack_require__.v(exports, module.id, "35a58b7c95860d720a3c");
/***/ }),
/* 4 */
@@ -186,7 +188,7 @@ module.exports = __webpack_require__.v(exports, module.id, "9d2b0c46ef31acbcf414
/*! runtime requirements: module, module.id, __webpack_exports__, __webpack_require__.v, __webpack_require__.* */
/***/ ((module, exports, __webpack_require__) => {
-module.exports = __webpack_require__.v(exports, module.id, "0925a077f3cf38995044")
+module.exports = __webpack_require__.v(exports, module.id, "5a6637e8d63cdf9c72da");
/***/ })
/******/ ]);
@@ -202,8 +204,9 @@ module.exports = __webpack_require__.v(exports, module.id, "0925a077f3cf38995044
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/ // Check if module is in cache
-/******/ if(__webpack_module_cache__[moduleId]) {
-/******/ return __webpack_module_cache__[moduleId].exports;
+/******/ var cachedModule = __webpack_module_cache__[moduleId];
+/******/ if (cachedModule !== undefined) {
+/******/ return cachedModule.exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = __webpack_module_cache__[moduleId] = {
@@ -220,6 +223,75 @@ module.exports = __webpack_require__.v(exports, module.id, "0925a077f3cf38995044
/******/ }
/******/
/************************************************************************/
+/******/ /* webpack/runtime/async module */
+/******/ (() => {
+/******/ var webpackQueues = typeof Symbol === "function" ? Symbol("webpack queues") : "__webpack_queues__";
+/******/ var webpackExports = typeof Symbol === "function" ? Symbol("webpack exports") : "__webpack_exports__";
+/******/ var webpackError = typeof Symbol === "function" ? Symbol("webpack error") : "__webpack_error__";
+/******/ var resolveQueue = (queue) => {
+/******/ if(queue && queue.d < 1) {
+/******/ queue.d = 1;
+/******/ queue.forEach((fn) => (fn.r--));
+/******/ queue.forEach((fn) => (fn.r-- ? fn.r++ : fn()));
+/******/ }
+/******/ }
+/******/ var wrapDeps = (deps) => (deps.map((dep) => {
+/******/ if(dep !== null && typeof dep === "object") {
+/******/ if(dep[webpackQueues]) return dep;
+/******/ if(dep.then) {
+/******/ var queue = [];
+/******/ queue.d = 0;
+/******/ dep.then((r) => {
+/******/ obj[webpackExports] = r;
+/******/ resolveQueue(queue);
+/******/ }, (e) => {
+/******/ obj[webpackError] = e;
+/******/ resolveQueue(queue);
+/******/ });
+/******/ var obj = {};
+/******/ obj[webpackQueues] = (fn) => (fn(queue));
+/******/ return obj;
+/******/ }
+/******/ }
+/******/ var ret = {};
+/******/ ret[webpackQueues] = x => {};
+/******/ ret[webpackExports] = dep;
+/******/ return ret;
+/******/ }));
+/******/ __webpack_require__.a = (module, body, hasAwait) => {
+/******/ var queue;
+/******/ hasAwait && ((queue = []).d = -1);
+/******/ var depQueues = new Set();
+/******/ var exports = module.exports;
+/******/ var currentDeps;
+/******/ var outerResolve;
+/******/ var reject;
+/******/ var promise = new Promise((resolve, rej) => {
+/******/ reject = rej;
+/******/ outerResolve = resolve;
+/******/ });
+/******/ promise[webpackExports] = exports;
+/******/ promise[webpackQueues] = (fn) => (queue && fn(queue), depQueues.forEach(fn), promise["catch"](x => {}));
+/******/ module.exports = promise;
+/******/ body((deps) => {
+/******/ currentDeps = wrapDeps(deps);
+/******/ var fn;
+/******/ var getResult = () => (currentDeps.map((d) => {
+/******/ if(d[webpackError]) throw d[webpackError];
+/******/ return d[webpackExports];
+/******/ }))
+/******/ var promise = new Promise((resolve) => {
+/******/ fn = () => (resolve(getResult));
+/******/ fn.r = 0;
+/******/ var fnQueue = (q) => (q !== queue && !depQueues.has(q) && (depQueues.add(q), q && !q.d && (fn.r++, q.push(fn))));
+/******/ currentDeps.map((dep) => (dep[webpackQueues](fnQueue)));
+/******/ });
+/******/ return fn.r ? promise : getResult();
+/******/ }, (err) => ((err ? reject(promise[webpackError] = err) : outerResolve(exports)), resolveQueue(queue)));
+/******/ queue && queue.d < 0 && (queue.d = 0);
+/******/ };
+/******/ })();
+/******/
/******/ /* webpack/runtime/define property getters */
/******/ (() => {
/******/ // define getter functions for harmony exports
@@ -234,7 +306,7 @@ module.exports = __webpack_require__.v(exports, module.id, "0925a077f3cf38995044
/******/
/******/ /* webpack/runtime/hasOwnProperty shorthand */
/******/ (() => {
-/******/ __webpack_require__.o = (obj, prop) => Object.prototype.hasOwnProperty.call(obj, prop)
+/******/ __webpack_require__.o = (obj, prop) => (Object.prototype.hasOwnProperty.call(obj, prop))
/******/ })();
/******/
/******/ /* webpack/runtime/make namespace object */
@@ -248,36 +320,50 @@ module.exports = __webpack_require__.v(exports, module.id, "0925a077f3cf38995044
/******/ };
/******/ })();
/******/
-/******/ /* webpack/runtime/publicPath */
-/******/ (() => {
-/******/ __webpack_require__.p = "dist/";
-/******/ })();
-/******/
-/******/ /* webpack/runtime/wasm chunk loading */
+/******/ /* webpack/runtime/wasm loading */
/******/ (() => {
/******/ __webpack_require__.v = (exports, wasmModuleId, wasmModuleHash, importsObj) => {
/******/ var req = fetch(__webpack_require__.p + "" + wasmModuleHash + ".wasm");
-/******/ if (typeof WebAssembly.instantiateStreaming === 'function') {
-/******/ return WebAssembly.instantiateStreaming(req, importsObj)
-/******/ .then((res) => Object.assign(exports, res.instance.exports));
-/******/ }
-/******/ return req
-/******/ .then((x) => x.arrayBuffer())
-/******/ .then((bytes) => WebAssembly.instantiate(bytes, importsObj))
-/******/ .then((res) => Object.assign(exports, res.instance.exports));
+/******/ var fallback = () => (req
+/******/ .then((x) => (x.arrayBuffer()))
+/******/ .then((bytes) => (WebAssembly.instantiate(bytes, importsObj)))
+/******/ .then((res) => (Object.assign(exports, res.instance.exports))));
+/******/ return req.then((res) => {
+/******/ if (typeof WebAssembly.instantiateStreaming === "function") {
+/******/ return WebAssembly.instantiateStreaming(res, importsObj)
+/******/ .then(
+/******/ (res) => (Object.assign(exports, res.instance.exports)),
+/******/ (e) => {
+/******/ if(res.headers.get("Content-Type") !== "application/wasm") {
+/******/ console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", e);
+/******/ return fallback();
+/******/ }
+/******/ throw e;
+/******/ }
+/******/ );
+/******/ }
+/******/ return fallback();
+/******/ });
/******/ };
/******/ })();
/******/
+/******/ /* webpack/runtime/publicPath */
+/******/ (() => {
+/******/ __webpack_require__.p = "dist/";
+/******/ })();
+/******/
/************************************************************************/
```
``` js
+/******/
/******/ // startup
-/******/ // Load entry module
-/******/ __webpack_require__(0);
+/******/ // Load entry module and return exports
/******/ // This entry module used 'module' so it can't be inlined
+/******/ var __webpack_exports__ = __webpack_require__(0);
+/******/
/******/ })()
;
```
@@ -287,35 +373,35 @@ module.exports = __webpack_require__.v(exports, module.id, "0925a077f3cf38995044
## Unoptimized
```
-asset output.js 9.05 KiB [emitted] (name: main)
-asset 0925a077f3cf38995044.wasm 67 bytes [emitted] [immutable] (auxiliary name: main)
-asset 9d2b0c46ef31acbcf414.wasm 62 bytes [emitted] [immutable] (auxiliary name: main)
-asset a7a690138d8dd16930b3.wasm 41 bytes [emitted] [immutable] (auxiliary name: main)
-chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 1.19 KiB (runtime) [entry] [rendered]
+asset output.js 13.2 KiB [emitted] (name: main)
+asset 5a6637e8d63cdf9c72da.wasm 67 bytes [emitted] [immutable] (auxiliary name: main)
+asset 35a58b7c95860d720a3c.wasm 62 bytes [emitted] [immutable] (auxiliary name: main)
+asset 0eaeab8b9fa3cef100d1.wasm 41 bytes [emitted] [immutable] (auxiliary name: main)
+chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 3.68 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 1.19 KiB 5 modules
+ runtime modules 3.68 KiB 6 modules
dependent modules 552 bytes (javascript) 170 bytes (webassembly) [dependent] 4 modules
./example.js 753 bytes [built] [code generated]
[no exports]
[used exports unknown]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.90.0 compiled successfully
```
## Production mode
```
-asset output.js 1.59 KiB [emitted] [minimized] (name: main)
-asset 908ca2d722f446ec8201.wasm 67 bytes [emitted] [immutable] (auxiliary name: main)
-asset ea4e26db3d258a94d99d.wasm 62 bytes [emitted] [immutable] (auxiliary name: main)
-asset f4c0bab8e2d961142f75.wasm 41 bytes [emitted] [immutable] (auxiliary name: main)
-chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 943 bytes (runtime) [entry] [rendered]
+asset output.js 2.89 KiB [emitted] [minimized] (name: main)
+asset 67aca7a09456080b5120.wasm 67 bytes [emitted] [immutable] (auxiliary name: main)
+asset 36825f9224dde8d88de0.wasm 62 bytes [emitted] [immutable] (auxiliary name: main)
+asset 10cff76bc58b7aa8f9cb.wasm 41 bytes [emitted] [immutable] (auxiliary name: main)
+chunk (runtime: main) output.js (main) 1.27 KiB (javascript) 170 bytes (webassembly) 3.42 KiB (runtime) [entry] [rendered]
> ./example.js main
+ runtime modules 3.42 KiB 5 modules
dependent modules 552 bytes (javascript) 170 bytes (webassembly) [dependent] 4 modules
- runtime modules 943 bytes 4 modules
./example.js 753 bytes [built] [code generated]
[no exports]
[no exports used]
entry ./example.js main
-webpack 5.11.1 compiled successfully
+webpack 5.90.0 compiled successfully
```
diff --git a/examples/wasm-simple/webpack.config.js b/examples/wasm-simple/webpack.config.js
index 70ba131d8c3..990ea91fc6f 100644
--- a/examples/wasm-simple/webpack.config.js
+++ b/examples/wasm-simple/webpack.config.js
@@ -1,5 +1,5 @@
module.exports = {
- // mode: "development || "production",
+ // mode: "development" || "production",
output: {
webassemblyModuleFilename: "[hash].wasm",
publicPath: "dist/"
diff --git a/examples/worker/README.md b/examples/worker/README.md
index 64be9aa6829..73b7e3633ec 100644
--- a/examples/worker/README.md
+++ b/examples/worker/README.md
@@ -272,7 +272,6 @@ export const add = (content, from) => {
/******/ doneFns && doneFns.forEach((fn) => (fn(event)));
/******/ if(prev) return prev(event);
/******/ }
-/******/ ;
/******/ var timeout = setTimeout(onScriptComplete.bind(null, undefined, { type: 'timeout', target: script }), 120000);
/******/ script.onerror = onScriptComplete.bind(null, script.onerror);
/******/ script.onload = onScriptComplete.bind(null, script.onload);
@@ -362,19 +361,21 @@ export const add = (content, from) => {
/******/ // add "moreModules" to the modules object,
/******/ // then flag all "chunkIds" as loaded and fire callback
/******/ var moduleId, chunkId, i = 0;
-/******/ for(moduleId in moreModules) {
-/******/ if(__webpack_require__.o(moreModules, moduleId)) {
-/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ if(chunkIds.some((id) => (installedChunks[id] !== 0))) {
+/******/ for(moduleId in moreModules) {
+/******/ if(__webpack_require__.o(moreModules, moduleId)) {
+/******/ __webpack_require__.m[moduleId] = moreModules[moduleId];
+/******/ }
/******/ }
+/******/ if(runtime) var result = runtime(__webpack_require__);
/******/ }
-/******/ if(runtime) runtime(__webpack_require__);
/******/ if(parentChunkLoadingFunction) parentChunkLoadingFunction(data);
/******/ for(;i < chunkIds.length; i++) {
/******/ chunkId = chunkIds[i];
/******/ if(__webpack_require__.o(installedChunks, chunkId) && installedChunks[chunkId]) {
/******/ installedChunks[chunkId][0]();
/******/ }
-/******/ installedChunks[chunkIds[i]] = 0;
+/******/ installedChunks[chunkId] = 0;
/******/ }
/******/
/******/ }
@@ -714,6 +715,7 @@ onmessage = async event => {
# dist/129.js
```javascript
+"use strict";
(self["webpackChunk"] = self["webpackChunk"] || []).push([[129],{
/***/ 2:
@@ -721,12 +723,11 @@ onmessage = async event => {
!*** ./fibonacci.js ***!
\**********************/
/*! namespace exports */
-/*! export fibonacci [provided] [maybe used in main, ./example.js|80:18-84:2 (runtime-defined)] [usage prevents renaming] */
-/*! other exports [not provided] [maybe used in main, ./example.js|80:18-84:2 (runtime-defined)] */
+/*! export fibonacci [provided] [maybe used in main, 9a81d90cfd0dfd13d748 (runtime-defined)] [usage prevents renaming] */
+/*! other exports [not provided] [maybe used in main, 9a81d90cfd0dfd13d748 (runtime-defined)] */
/*! runtime requirements: __webpack_require__.r, __webpack_exports__, __webpack_require__.d, __webpack_require__.* */
/***/ ((__unused_webpack_module, __webpack_exports__, __webpack_require__) => {
-"use strict";
__webpack_require__.r(__webpack_exports__);
/* harmony export */ __webpack_require__.d(__webpack_exports__, {
/* harmony export */ "fibonacci": () => (/* binding */ fibonacci)
@@ -746,69 +747,69 @@ function fibonacci(n) {
## Unoptimized
```
-asset main.js 12.2 KiB [emitted] (name: main)
+asset main.js 12.3 KiB [emitted] (name: main)
asset workers/fibonacci.js 5.43 KiB [emitted] (name: fibonacci)
-asset 129.js 937 bytes [emitted]
+asset 129.js 931 bytes [emitted]
asset chat.js 911 bytes [emitted] (name: chat)
-chunk (runtime: ./example.js|80:18-84:2, main) 129.js 103 bytes [rendered]
+chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered]
> ./fibonacci ./example.js 70:30-51
> ./fibonacci ./fib-worker.js 2:29-50
./fibonacci.js 103 bytes [built] [code generated]
[exports: fibonacci]
import() ./fibonacci ./example.js 70:30-51
import() ./fibonacci ./fib-worker.js 2:29-50
-chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.64 KiB (runtime) [entry] [rendered]
+chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.71 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 5.64 KiB 8 modules
+ runtime modules 5.71 KiB 8 modules
./example.js 2.25 KiB [built] [code generated]
[no exports used]
entry ./example.js main
-chunk (runtime: ./example.js|25:19-31:1) chat.js (chat) 527 bytes [entry] [rendered]
+chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 527 bytes [entry] [rendered]
> ./example.js 25:19-31:1
./chat-worker.js + 1 modules 527 bytes [built] [code generated]
[no exports]
[no exports used]
new Worker() ./chat-worker.js ./example.js 25:19-31:1
-chunk (runtime: ./example.js|80:18-84:2) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.14 KiB (runtime) [entry] [rendered]
+chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.14 KiB (runtime) [entry] [rendered]
> ./example.js 80:18-84:2
runtime modules 2.14 KiB 7 modules
./fib-worker.js 176 bytes [built] [code generated]
[no exports used]
new Worker() ./fib-worker.js ./example.js 80:18-84:2
-webpack 5.27.2 compiled successfully
+webpack 5.78.0 compiled successfully
```
## Production mode
```
-asset main.js 3.44 KiB [emitted] [minimized] (name: main)
+asset main.js 3.46 KiB [emitted] [minimized] (name: main)
asset workers/fibonacci.js 945 bytes [emitted] [minimized] (name: fibonacci)
asset chat.js 270 bytes [emitted] [minimized] (name: chat)
asset 129.js 166 bytes [emitted] [minimized]
-chunk (runtime: ./example.js|80:18-84:2, main) 129.js 103 bytes [rendered]
+chunk (runtime: 9a81d90cfd0dfd13d748, main) 129.js 103 bytes [rendered]
> ./fibonacci ./example.js 70:30-51
> ./fibonacci ./fib-worker.js 2:29-50
./fibonacci.js 103 bytes [built] [code generated]
[exports: fibonacci]
import() ./fibonacci ./example.js 70:30-51
import() ./fibonacci ./fib-worker.js 2:29-50
-chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.64 KiB (runtime) [entry] [rendered]
+chunk (runtime: main) main.js (main) 2.25 KiB (javascript) 5.71 KiB (runtime) [entry] [rendered]
> ./example.js main
- runtime modules 5.64 KiB 8 modules
+ runtime modules 5.71 KiB 8 modules
./example.js 2.25 KiB [built] [code generated]
[no exports used]
entry ./example.js main
-chunk (runtime: ./example.js|25:19-31:1) chat.js (chat) 527 bytes [entry] [rendered]
+chunk (runtime: 1fad8bf8de78b0a77bfd) chat.js (chat) 527 bytes [entry] [rendered]
> ./example.js 25:19-31:1
./chat-worker.js + 1 modules 527 bytes [built] [code generated]
[no exports]
[no exports used]
new Worker() ./chat-worker.js ./example.js 25:19-31:1
-chunk (runtime: ./example.js|80:18-84:2) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.14 KiB (runtime) [entry] [rendered]
+chunk (runtime: 9a81d90cfd0dfd13d748) workers/fibonacci.js (fibonacci) 176 bytes (javascript) 2.14 KiB (runtime) [entry] [rendered]
> ./example.js 80:18-84:2
runtime modules 2.14 KiB 7 modules
./fib-worker.js 176 bytes [built] [code generated]
[no exports used]
new Worker() ./fib-worker.js ./example.js 80:18-84:2
-webpack 5.27.2 compiled successfully
+webpack 5.78.0 compiled successfully
```
diff --git a/examples/worker/webpack.config.js b/examples/worker/webpack.config.js
index fe0e0804386..40032472184 100644
--- a/examples/worker/webpack.config.js
+++ b/examples/worker/webpack.config.js
@@ -1,4 +1,4 @@
-var path = require("path");
+const path = require("path");
module.exports = {
entry: "./example.js",
diff --git a/generate-types-config.js b/generate-types-config.js
index 59d8b78920c..b1a47a8285e 100644
--- a/generate-types-config.js
+++ b/generate-types-config.js
@@ -1,7 +1,9 @@
module.exports = {
nameMapping: {
FsStats: /^Stats Import fs/,
+ validateFunction: /^validate Import/,
Configuration: /^WebpackOptions /
},
- exclude: [/^devServer in WebpackOptions /]
+ exclude: [/^devServer in WebpackOptions /],
+ include: [/^(_module|_compilation|_compiler) in NormalModuleLoaderContext /]
};
diff --git a/hot/dev-server.js b/hot/dev-server.js
index a93ab3700ba..4812864a128 100644
--- a/hot/dev-server.js
+++ b/hot/dev-server.js
@@ -4,9 +4,10 @@
*/
/* globals __webpack_hash__ */
if (module.hot) {
+ /** @type {undefined|string} */
var lastHash;
var upToDate = function upToDate() {
- return lastHash.indexOf(__webpack_hash__) >= 0;
+ return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
};
var log = require("./log");
var check = function check() {
@@ -14,12 +15,20 @@ if (module.hot) {
.check(true)
.then(function (updatedModules) {
if (!updatedModules) {
- log("warning", "[HMR] Cannot find update. Need to do a full reload!");
+ log(
+ "warning",
+ "[HMR] Cannot find update. " +
+ (typeof window !== "undefined"
+ ? "Need to do a full reload!"
+ : "Please reload manually!")
+ );
log(
"warning",
"[HMR] (Probably because of restarting the webpack-dev-server)"
);
- window.location.reload();
+ if (typeof window !== "undefined") {
+ window.location.reload();
+ }
return;
}
@@ -38,10 +47,15 @@ if (module.hot) {
if (["abort", "fail"].indexOf(status) >= 0) {
log(
"warning",
- "[HMR] Cannot apply update. Need to do a full reload!"
+ "[HMR] Cannot apply update. " +
+ (typeof window !== "undefined"
+ ? "Need to do a full reload!"
+ : "Please reload manually!")
);
log("warning", "[HMR] " + log.formatError(err));
- window.location.reload();
+ if (typeof window !== "undefined") {
+ window.location.reload();
+ }
} else {
log("warning", "[HMR] Update failed: " + log.formatError(err));
}
diff --git a/hot/lazy-compilation-node.js b/hot/lazy-compilation-node.js
index 5ec254db312..da4058583b1 100644
--- a/hot/lazy-compilation-node.js
+++ b/hot/lazy-compilation-node.js
@@ -3,13 +3,21 @@
"use strict";
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
+
+/**
+ * @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
+ * @returns {() => void} function to destroy response
+ */
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
var active = options.active;
var module = options.module;
+ /** @type {import("http").IncomingMessage} */
var response;
- var request = require("http").request(
+ var request = (
+ urlBase.startsWith("https") ? require("https") : require("http")
+ ).request(
urlBase + data,
{
agent: false,
@@ -25,6 +33,10 @@ exports.keepAlive = function (options) {
}
}
);
+
+ /**
+ * @param {Error} err error
+ */
function errorHandler(err) {
err.message =
"Problem communicating active modules to the server: " + err.message;
diff --git a/hot/lazy-compilation-web.js b/hot/lazy-compilation-web.js
index 62d955c5a22..ec8253f0a3c 100644
--- a/hot/lazy-compilation-web.js
+++ b/hot/lazy-compilation-web.js
@@ -9,6 +9,7 @@ if (typeof EventSource !== "function") {
}
var urlBase = decodeURIComponent(__resourceQuery.slice(1));
+/** @type {EventSource | undefined} */
var activeEventSource;
var activeKeys = new Map();
var errorHandlers = new Set();
@@ -19,6 +20,10 @@ var updateEventSource = function updateEventSource() {
activeEventSource = new EventSource(
urlBase + Array.from(activeKeys.keys()).join("@")
);
+ /**
+ * @this {EventSource}
+ * @param {Event & { message?: string, filename?: string, lineno?: number, colno?: number, error?: Error }} event event
+ */
activeEventSource.onerror = function (event) {
errorHandlers.forEach(function (onError) {
onError(
@@ -42,6 +47,10 @@ var updateEventSource = function updateEventSource() {
}
};
+/**
+ * @param {{ data: string, onError: (err: Error) => void, active: boolean, module: module }} options options
+ * @returns {() => void} function to destroy response
+ */
exports.keepAlive = function (options) {
var data = options.data;
var onError = options.onError;
diff --git a/hot/log-apply-result.js b/hot/log-apply-result.js
index d4452f9308c..cb46366dd44 100644
--- a/hot/log-apply-result.js
+++ b/hot/log-apply-result.js
@@ -2,6 +2,11 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
+
+/**
+ * @param {(string | number)[]} updatedModules updated modules
+ * @param {(string | number)[] | null} renewedModules renewed modules
+ */
module.exports = function (updatedModules, renewedModules) {
var unacceptedModules = updatedModules.filter(function (moduleId) {
return renewedModules && renewedModules.indexOf(moduleId) < 0;
diff --git a/hot/log.js b/hot/log.js
index 483ab4080b0..63758822ae6 100644
--- a/hot/log.js
+++ b/hot/log.js
@@ -1,7 +1,14 @@
+/** @typedef {"info" | "warning" | "error"} LogLevel */
+
+/** @type {LogLevel} */
var logLevel = "info";
function dummy() {}
+/**
+ * @param {LogLevel} level log level
+ * @returns {boolean} true, if should log
+ */
function shouldLog(level) {
var shouldLog =
(logLevel === "info" && level === "info") ||
@@ -10,6 +17,10 @@ function shouldLog(level) {
return shouldLog;
}
+/**
+ * @param {(msg?: string) => void} logFn log function
+ * @returns {(level: LogLevel, msg?: string) => void} function that logs when log level is sufficient
+ */
function logGroup(logFn) {
return function (level, msg) {
if (shouldLog(level)) {
@@ -18,6 +29,10 @@ function logGroup(logFn) {
};
}
+/**
+ * @param {LogLevel} level log level
+ * @param {string|Error} msg message
+ */
module.exports = function (level, msg) {
if (shouldLog(level)) {
if (level === "info") {
@@ -30,11 +45,9 @@ module.exports = function (level, msg) {
}
};
-/* eslint-disable node/no-unsupported-features/node-builtins */
var group = console.group || dummy;
var groupCollapsed = console.groupCollapsed || dummy;
var groupEnd = console.groupEnd || dummy;
-/* eslint-enable node/no-unsupported-features/node-builtins */
module.exports.group = logGroup(group);
@@ -42,10 +55,17 @@ module.exports.groupCollapsed = logGroup(groupCollapsed);
module.exports.groupEnd = logGroup(groupEnd);
+/**
+ * @param {LogLevel} level log level
+ */
module.exports.setLogLevel = function (level) {
logLevel = level;
};
+/**
+ * @param {Error} err error
+ * @returns {string} formatted error
+ */
module.exports.formatError = function (err) {
var message = err.message;
var stack = err.stack;
@@ -53,7 +73,6 @@ module.exports.formatError = function (err) {
return message;
} else if (stack.indexOf(message) < 0) {
return message + "\n" + stack;
- } else {
- return stack;
}
+ return stack;
};
diff --git a/hot/only-dev-server.js b/hot/only-dev-server.js
index 7312beb82d6..5979ab54353 100644
--- a/hot/only-dev-server.js
+++ b/hot/only-dev-server.js
@@ -2,11 +2,12 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
-/*globals __webpack_hash__ */
+/* globals __webpack_hash__ */
if (module.hot) {
+ /** @type {undefined|string} */
var lastHash;
var upToDate = function upToDate() {
- return lastHash.indexOf(__webpack_hash__) >= 0;
+ return /** @type {string} */ (lastHash).indexOf(__webpack_hash__) >= 0;
};
var log = require("./log");
var check = function check() {
diff --git a/hot/poll.js b/hot/poll.js
index dab215a426a..b87c2525944 100644
--- a/hot/poll.js
+++ b/hot/poll.js
@@ -2,11 +2,14 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
-/*globals __resourceQuery */
+/* globals __resourceQuery */
if (module.hot) {
- var hotPollInterval = +__resourceQuery.substr(1) || 10 * 60 * 1000;
+ var hotPollInterval = +__resourceQuery.slice(1) || 10 * 60 * 1000;
var log = require("./log");
+ /**
+ * @param {boolean=} fromUpdate true when called from update
+ */
var checkForUpdate = function checkForUpdate(fromUpdate) {
if (module.hot.status() === "idle") {
module.hot
diff --git a/hot/signal.js b/hot/signal.js
index ef949521f15..36a0cbe38c7 100644
--- a/hot/signal.js
+++ b/hot/signal.js
@@ -2,9 +2,13 @@
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
-/*globals __resourceQuery */
+/* globals __resourceQuery */
if (module.hot) {
var log = require("./log");
+
+ /**
+ * @param {boolean=} fromUpdate true when called from update
+ */
var checkForUpdate = function checkForUpdate(fromUpdate) {
module.hot
.check()
@@ -45,7 +49,7 @@ if (module.hot) {
});
};
- process.on(__resourceQuery.substr(1) || "SIGUSR2", function () {
+ process.on(__resourceQuery.slice(1) || "SIGUSR2", function () {
if (module.hot.status() !== "idle") {
log(
"warning",
diff --git a/jest.config.js b/jest.config.js
new file mode 100644
index 00000000000..2cc6d151b2e
--- /dev/null
+++ b/jest.config.js
@@ -0,0 +1,54 @@
+/** @type {import('jest').Config} */
+const config = {
+ prettierPath: require.resolve("prettier-2"),
+ forceExit: true,
+ setupFilesAfterEnv: ["/test/setupTestFramework.js"],
+ testMatch: [
+ "/test/*.test.js",
+ "/test/*.basictest.js",
+ "/test/*.longtest.js",
+ "/test/*.unittest.js"
+ ],
+ watchPathIgnorePatterns: [
+ "/.git",
+ "/node_modules",
+ "/test/js",
+ "/test/browsertest/js",
+ "/test/fixtures/temp-cache-fixture",
+ "/test/fixtures/temp-",
+ "/benchmark",
+ "/assembly",
+ "/tooling",
+ "/examples/*/dist",
+ "/coverage",
+ "/.eslintcache"
+ ],
+ modulePathIgnorePatterns: [
+ "/.git",
+ "/node_modules/webpack/node_modules",
+ "/test/js",
+ "/test/browsertest/js",
+ "/test/fixtures/temp-cache-fixture",
+ "/test/fixtures/temp-",
+ "/benchmark",
+ "/examples/*/dist",
+ "/coverage",
+ "/.eslintcache"
+ ],
+ transformIgnorePatterns: [""],
+ coverageDirectory: "/coverage",
+ coveragePathIgnorePatterns: [
+ "\\.runtime\\.js$",
+ "/test",
+ "/schemas",
+ "/node_modules"
+ ],
+ testEnvironment: "./test/patch-node-env.js",
+ coverageReporters: ["json"],
+ snapshotFormat: {
+ escapeString: true,
+ printBasicPrototype: true
+ }
+};
+
+module.exports = config;
diff --git a/lib/APIPlugin.js b/lib/APIPlugin.js
index d42aedec399..a36422ed250 100644
--- a/lib/APIPlugin.js
+++ b/lib/APIPlugin.js
@@ -5,10 +5,17 @@
"use strict";
+const InitFragment = require("./InitFragment");
+const {
+ JAVASCRIPT_MODULE_TYPE_AUTO,
+ JAVASCRIPT_MODULE_TYPE_DYNAMIC,
+ JAVASCRIPT_MODULE_TYPE_ESM
+} = require("./ModuleTypeConstants");
const RuntimeGlobals = require("./RuntimeGlobals");
const WebpackError = require("./WebpackError");
const ConstDependency = require("./dependencies/ConstDependency");
const BasicEvaluatedExpression = require("./javascript/BasicEvaluatedExpression");
+const JavascriptModulesPlugin = require("./javascript/JavascriptModulesPlugin");
const {
toConstantDependency,
evaluateToString
@@ -17,103 +24,127 @@ const ChunkNameRuntimeModule = require("./runtime/ChunkNameRuntimeModule");
const GetFullHashRuntimeModule = require("./runtime/GetFullHashRuntimeModule");
/** @typedef {import("./Compiler")} Compiler */
+/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
+/** @typedef {import("./Module").BuildInfo} BuildInfo */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
+/** @typedef {import("./javascript/JavascriptParser").Range} Range */
-/* eslint-disable camelcase */
-const REPLACEMENTS = {
- __webpack_require__: {
- expr: RuntimeGlobals.require,
- req: [RuntimeGlobals.require],
- type: "function",
- assign: false
- },
- __webpack_public_path__: {
- expr: RuntimeGlobals.publicPath,
- req: [RuntimeGlobals.publicPath],
- type: "string",
- assign: true
- },
- __webpack_base_uri__: {
- expr: RuntimeGlobals.baseURI,
- req: [RuntimeGlobals.baseURI],
- type: "string",
- assign: true
- },
- __webpack_modules__: {
- expr: RuntimeGlobals.moduleFactories,
- req: [RuntimeGlobals.moduleFactories],
- type: "object",
- assign: false
- },
- __webpack_chunk_load__: {
- expr: RuntimeGlobals.ensureChunk,
- req: [RuntimeGlobals.ensureChunk],
- type: "function",
- assign: true
- },
- __non_webpack_require__: {
- expr: "require",
- req: null,
- type: undefined, // type is not known, depends on environment
- assign: true
- },
- __webpack_nonce__: {
- expr: RuntimeGlobals.scriptNonce,
- req: [RuntimeGlobals.scriptNonce],
- type: "string",
- assign: true
- },
- __webpack_hash__: {
- expr: `${RuntimeGlobals.getFullHash}()`,
- req: [RuntimeGlobals.getFullHash],
- type: "string",
- assign: false
- },
- __webpack_chunkname__: {
- expr: RuntimeGlobals.chunkName,
- req: [RuntimeGlobals.chunkName],
- type: "string",
- assign: false
- },
- __webpack_get_script_filename__: {
- expr: RuntimeGlobals.getChunkScriptFilename,
- req: [RuntimeGlobals.getChunkScriptFilename],
- type: "function",
- assign: true
- },
- __webpack_runtime_id__: {
- expr: RuntimeGlobals.runtimeId,
- req: [RuntimeGlobals.runtimeId],
- assign: false
- },
- "require.onError": {
- expr: RuntimeGlobals.uncaughtErrorHandler,
- req: [RuntimeGlobals.uncaughtErrorHandler],
- type: undefined, // type is not known, could be function or undefined
- assign: true // is never a pattern
- },
- __system_context__: {
- expr: RuntimeGlobals.systemContext,
- req: [RuntimeGlobals.systemContext],
- type: "object",
- assign: false
- },
- __webpack_share_scopes__: {
- expr: RuntimeGlobals.shareScopeMap,
- req: [RuntimeGlobals.shareScopeMap],
- type: "object",
- assign: false
- },
- __webpack_init_sharing__: {
- expr: RuntimeGlobals.initializeSharing,
- req: [RuntimeGlobals.initializeSharing],
- type: "function",
- assign: true
- }
-};
-/* eslint-enable camelcase */
+/**
+ * @param {boolean | undefined} module true if ES module
+ * @param {string} importMetaName `import.meta` name
+ * @returns {Record} replacements
+ */
+function getReplacements(module, importMetaName) {
+ return {
+ __webpack_require__: {
+ expr: RuntimeGlobals.require,
+ req: [RuntimeGlobals.require],
+ type: "function",
+ assign: false
+ },
+ __webpack_public_path__: {
+ expr: RuntimeGlobals.publicPath,
+ req: [RuntimeGlobals.publicPath],
+ type: "string",
+ assign: true
+ },
+ __webpack_base_uri__: {
+ expr: RuntimeGlobals.baseURI,
+ req: [RuntimeGlobals.baseURI],
+ type: "string",
+ assign: true
+ },
+ __webpack_modules__: {
+ expr: RuntimeGlobals.moduleFactories,
+ req: [RuntimeGlobals.moduleFactories],
+ type: "object",
+ assign: false
+ },
+ __webpack_chunk_load__: {
+ expr: RuntimeGlobals.ensureChunk,
+ req: [RuntimeGlobals.ensureChunk],
+ type: "function",
+ assign: true
+ },
+ __non_webpack_require__: {
+ expr: module
+ ? `__WEBPACK_EXTERNAL_createRequire(${importMetaName}.url)`
+ : "require",
+ req: null,
+ type: undefined, // type is not known, depends on environment
+ assign: true
+ },
+ __webpack_nonce__: {
+ expr: RuntimeGlobals.scriptNonce,
+ req: [RuntimeGlobals.scriptNonce],
+ type: "string",
+ assign: true
+ },
+ __webpack_hash__: {
+ expr: `${RuntimeGlobals.getFullHash}()`,
+ req: [RuntimeGlobals.getFullHash],
+ type: "string",
+ assign: false
+ },
+ __webpack_chunkname__: {
+ expr: RuntimeGlobals.chunkName,
+ req: [RuntimeGlobals.chunkName],
+ type: "string",
+ assign: false
+ },
+ __webpack_get_script_filename__: {
+ expr: RuntimeGlobals.getChunkScriptFilename,
+ req: [RuntimeGlobals.getChunkScriptFilename],
+ type: "function",
+ assign: true
+ },
+ __webpack_runtime_id__: {
+ expr: RuntimeGlobals.runtimeId,
+ req: [RuntimeGlobals.runtimeId],
+ assign: false
+ },
+ "require.onError": {
+ expr: RuntimeGlobals.uncaughtErrorHandler,
+ req: [RuntimeGlobals.uncaughtErrorHandler],
+ type: undefined, // type is not known, could be function or undefined
+ assign: true // is never a pattern
+ },
+ __system_context__: {
+ expr: RuntimeGlobals.systemContext,
+ req: [RuntimeGlobals.systemContext],
+ type: "object",
+ assign: false
+ },
+ __webpack_share_scopes__: {
+ expr: RuntimeGlobals.shareScopeMap,
+ req: [RuntimeGlobals.shareScopeMap],
+ type: "object",
+ assign: false
+ },
+ __webpack_init_sharing__: {
+ expr: RuntimeGlobals.initializeSharing,
+ req: [RuntimeGlobals.initializeSharing],
+ type: "function",
+ assign: true
+ }
+ };
+}
+
+const PLUGIN_NAME = "APIPlugin";
+
+/**
+ * @typedef {object} APIPluginOptions
+ * @property {boolean} [module] the output filename
+ */
class APIPlugin {
+ /**
+ * @param {APIPluginOptions} [options] options
+ */
+ constructor(options = {}) {
+ this.options = options;
+ }
+
/**
* Apply the plugin
* @param {Compiler} compiler the compiler instance
@@ -121,8 +152,16 @@ class APIPlugin {
*/
apply(compiler) {
compiler.hooks.compilation.tap(
- "APIPlugin",
+ PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
+ const importMetaName = /** @type {string} */ (
+ compilation.outputOptions.importMetaName
+ );
+ const REPLACEMENTS = getReplacements(
+ this.options.module,
+ importMetaName
+ );
+
compilation.dependencyTemplates.set(
ConstDependency,
new ConstDependency.Template()
@@ -130,88 +169,153 @@ class APIPlugin {
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.chunkName)
- .tap("APIPlugin", chunk => {
+ .tap(PLUGIN_NAME, chunk => {
compilation.addRuntimeModule(
chunk,
- new ChunkNameRuntimeModule(chunk.name)
+ new ChunkNameRuntimeModule(/** @type {string} */ (chunk.name))
);
return true;
});
compilation.hooks.runtimeRequirementInTree
.for(RuntimeGlobals.getFullHash)
- .tap("APIPlugin", (chunk, set) => {
+ .tap(PLUGIN_NAME, (chunk, set) => {
compilation.addRuntimeModule(chunk, new GetFullHashRuntimeModule());
return true;
});
+ const hooks = JavascriptModulesPlugin.getCompilationHooks(compilation);
+
+ hooks.renderModuleContent.tap(
+ PLUGIN_NAME,
+ (source, module, renderContext) => {
+ if (/** @type {BuildInfo} */ (module.buildInfo).needCreateRequire) {
+ const needPrefix =
+ renderContext.runtimeTemplate.supportNodePrefixForCoreModules();
+ const chunkInitFragments = [
+ new InitFragment(
+ `import { createRequire as __WEBPACK_EXTERNAL_createRequire } from "${
+ needPrefix ? "node:" : ""
+ }module";\n`,
+ InitFragment.STAGE_HARMONY_IMPORTS,
+ 0,
+ "external module node-commonjs"
+ )
+ ];
+
+ renderContext.chunkInitFragments.push(...chunkInitFragments);
+ }
+
+ return source;
+ }
+ );
+
/**
* @param {JavascriptParser} parser the parser
*/
const handler = parser => {
- Object.keys(REPLACEMENTS).forEach(key => {
+ for (const key of Object.keys(REPLACEMENTS)) {
const info = REPLACEMENTS[key];
- parser.hooks.expression
- .for(key)
- .tap(
- "APIPlugin",
- toConstantDependency(parser, info.expr, info.req)
- );
+ parser.hooks.expression.for(key).tap(PLUGIN_NAME, expression => {
+ const dep = toConstantDependency(parser, info.expr, info.req);
+
+ if (key === "__non_webpack_require__" && this.options.module) {
+ /** @type {BuildInfo} */
+ (parser.state.module.buildInfo).needCreateRequire = true;
+ }
+
+ return dep(expression);
+ });
if (info.assign === false) {
- parser.hooks.assign.for(key).tap("APIPlugin", expr => {
+ parser.hooks.assign.for(key).tap(PLUGIN_NAME, expr => {
const err = new WebpackError(`${key} must not be assigned`);
- err.loc = expr.loc;
+ err.loc = /** @type {DependencyLocation} */ (expr.loc);
throw err;
});
}
if (info.type) {
parser.hooks.evaluateTypeof
.for(key)
- .tap("APIPlugin", evaluateToString(info.type));
+ .tap(PLUGIN_NAME, evaluateToString(info.type));
}
- });
+ }
parser.hooks.expression
.for("__webpack_layer__")
- .tap("APIPlugin", expr => {
+ .tap(PLUGIN_NAME, expr => {
const dep = new ConstDependency(
JSON.stringify(parser.state.module.layer),
- expr.range
+ /** @type {Range} */ (expr.range)
);
- dep.loc = expr.loc;
+ dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
parser.hooks.evaluateIdentifier
.for("__webpack_layer__")
- .tap("APIPlugin", expr =>
+ .tap(PLUGIN_NAME, expr =>
(parser.state.module.layer === null
? new BasicEvaluatedExpression().setNull()
: new BasicEvaluatedExpression().setString(
parser.state.module.layer
- )
- ).setRange(expr.range)
+ )
+ ).setRange(/** @type {Range} */ (expr.range))
);
parser.hooks.evaluateTypeof
.for("__webpack_layer__")
- .tap("APIPlugin", expr =>
+ .tap(PLUGIN_NAME, expr =>
new BasicEvaluatedExpression()
.setString(
parser.state.module.layer === null ? "object" : "string"
)
- .setRange(expr.range)
+ .setRange(/** @type {Range} */ (expr.range))
);
+
+ parser.hooks.expression
+ .for("__webpack_module__.id")
+ .tap(PLUGIN_NAME, expr => {
+ /** @type {BuildInfo} */
+ (parser.state.module.buildInfo).moduleConcatenationBailout =
+ "__webpack_module__.id";
+ const dep = new ConstDependency(
+ `${parser.state.module.moduleArgument}.id`,
+ /** @type {Range} */ (expr.range),
+ [RuntimeGlobals.moduleId]
+ );
+ dep.loc = /** @type {DependencyLocation} */ (expr.loc);
+ parser.state.module.addPresentationalDependency(dep);
+ return true;
+ });
+
+ parser.hooks.expression
+ .for("__webpack_module__")
+ .tap(PLUGIN_NAME, expr => {
+ /** @type {BuildInfo} */
+ (parser.state.module.buildInfo).moduleConcatenationBailout =
+ "__webpack_module__";
+ const dep = new ConstDependency(
+ parser.state.module.moduleArgument,
+ /** @type {Range} */ (expr.range),
+ [RuntimeGlobals.module]
+ );
+ dep.loc = /** @type {DependencyLocation} */ (expr.loc);
+ parser.state.module.addPresentationalDependency(dep);
+ return true;
+ });
+ parser.hooks.evaluateTypeof
+ .for("__webpack_module__")
+ .tap(PLUGIN_NAME, evaluateToString("object"));
};
normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("APIPlugin", handler);
+ .for(JAVASCRIPT_MODULE_TYPE_AUTO)
+ .tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("APIPlugin", handler);
+ .for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
+ .tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
- .for("javascript/esm")
- .tap("APIPlugin", handler);
+ .for(JAVASCRIPT_MODULE_TYPE_ESM)
+ .tap(PLUGIN_NAME, handler);
}
);
}
diff --git a/lib/AbstractMethodError.js b/lib/AbstractMethodError.js
index bbf2d08a6c7..7a9d2f992b4 100644
--- a/lib/AbstractMethodError.js
+++ b/lib/AbstractMethodError.js
@@ -13,18 +13,22 @@ const CURRENT_METHOD_REGEXP = /at ([a-zA-Z0-9_.]*)/;
* @returns {string} message
*/
function createMessage(method) {
- return `Abstract method${method ? " " + method : ""}. Must be overridden.`;
+ return `Abstract method${method ? ` ${method}` : ""}. Must be overridden.`;
}
/**
* @constructor
*/
function Message() {
- /** @type {string} */
+ /** @type {string | undefined} */
this.stack = undefined;
Error.captureStackTrace(this);
- /** @type {RegExpMatchArray} */
- const match = this.stack.split("\n")[3].match(CURRENT_METHOD_REGEXP);
+ /** @type {RegExpMatchArray | null} */
+ const match =
+ /** @type {string} */
+ (/** @type {unknown} */ (this.stack))
+ .split("\n")[3]
+ .match(CURRENT_METHOD_REGEXP);
this.message = match && match[1] ? createMessage(match[1]) : createMessage();
}
@@ -32,12 +36,13 @@ function Message() {
/**
* Error for abstract method
* @example
+ * ```js
* class FooClass {
* abstractMethod() {
* throw new AbstractMethodError(); // error message: Abstract method FooClass.abstractMethod. Must be overridden.
* }
* }
- *
+ * ```
*/
class AbstractMethodError extends WebpackError {
constructor() {
diff --git a/lib/AsyncDependenciesBlock.js b/lib/AsyncDependenciesBlock.js
index d85b9b5e600..539c20cb35d 100644
--- a/lib/AsyncDependenciesBlock.js
+++ b/lib/AsyncDependenciesBlock.js
@@ -15,13 +15,15 @@ const makeSerializable = require("./util/makeSerializable");
/** @typedef {import("./Dependency").UpdateHashContext} UpdateHashContext */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
/** @typedef {import("./Module")} Module */
+/** @typedef {import("./serialization/ObjectMiddleware").ObjectDeserializerContext} ObjectDeserializerContext */
+/** @typedef {import("./serialization/ObjectMiddleware").ObjectSerializerContext} ObjectSerializerContext */
/** @typedef {import("./util/Hash")} Hash */
class AsyncDependenciesBlock extends DependenciesBlock {
/**
- * @param {ChunkGroupOptions & { entryOptions?: EntryOptions }} groupOptions options for the group
- * @param {DependencyLocation=} loc the line of code
- * @param {string=} request the request
+ * @param {(ChunkGroupOptions & { entryOptions?: EntryOptions }) | null} groupOptions options for the group
+ * @param {(DependencyLocation | null)=} loc the line of code
+ * @param {(string | null)=} request the request
*/
constructor(groupOptions, loc, request) {
super();
@@ -33,23 +35,25 @@ class AsyncDependenciesBlock extends DependenciesBlock {
this.groupOptions = groupOptions;
this.loc = loc;
this.request = request;
- /** @type {DependenciesBlock} */
- this.parent = undefined;
+ this._stringifiedGroupOptions = undefined;
}
/**
- * @returns {string} The name of the chunk
+ * @returns {string | undefined} The name of the chunk
*/
get chunkName() {
return this.groupOptions.name;
}
/**
- * @param {string} value The new chunk name
+ * @param {string | undefined} value The new chunk name
* @returns {void}
*/
set chunkName(value) {
- this.groupOptions.name = value;
+ if (this.groupOptions.name !== value) {
+ this.groupOptions.name = value;
+ this._stringifiedGroupOptions = undefined;
+ }
}
/**
@@ -59,12 +63,19 @@ class AsyncDependenciesBlock extends DependenciesBlock {
*/
updateHash(hash, context) {
const { chunkGraph } = context;
- hash.update(JSON.stringify(this.groupOptions));
+ if (this._stringifiedGroupOptions === undefined) {
+ this._stringifiedGroupOptions = JSON.stringify(this.groupOptions);
+ }
const chunkGroup = chunkGraph.getBlockChunkGroup(this);
- hash.update(chunkGroup ? chunkGroup.id : "");
+ hash.update(
+ `${this._stringifiedGroupOptions}${chunkGroup ? chunkGroup.id : ""}`
+ );
super.updateHash(hash, context);
}
+ /**
+ * @param {ObjectSerializerContext} context context
+ */
serialize(context) {
const { write } = context;
write(this.groupOptions);
@@ -73,6 +84,9 @@ class AsyncDependenciesBlock extends DependenciesBlock {
super.serialize(context);
}
+ /**
+ * @param {ObjectDeserializerContext} context context
+ */
deserialize(context) {
const { read } = context;
this.groupOptions = read();
diff --git a/lib/AsyncDependencyToInitialChunkError.js b/lib/AsyncDependencyToInitialChunkError.js
index 570eb51cd17..75888f869a3 100644
--- a/lib/AsyncDependencyToInitialChunkError.js
+++ b/lib/AsyncDependencyToInitialChunkError.js
@@ -25,8 +25,6 @@ class AsyncDependencyToInitialChunkError extends WebpackError {
this.name = "AsyncDependencyToInitialChunkError";
this.module = module;
this.loc = loc;
-
- Error.captureStackTrace(this, this.constructor);
}
}
diff --git a/lib/AutomaticPrefetchPlugin.js b/lib/AutomaticPrefetchPlugin.js
index 5152574e33a..991ffc91732 100644
--- a/lib/AutomaticPrefetchPlugin.js
+++ b/lib/AutomaticPrefetchPlugin.js
@@ -27,6 +27,7 @@ class AutomaticPrefetchPlugin {
);
}
);
+ /** @type {{context: string | null, request: string}[] | null} */
let lastModules = null;
compiler.hooks.afterCompile.tap("AutomaticPrefetchPlugin", compilation => {
lastModules = [];
@@ -44,7 +45,7 @@ class AutomaticPrefetchPlugin {
"AutomaticPrefetchPlugin",
(compilation, callback) => {
if (!lastModules) return callback();
- asyncLib.forEach(
+ asyncLib.each(
lastModules,
(m, callback) => {
compilation.addModuleChain(
diff --git a/lib/BannerPlugin.js b/lib/BannerPlugin.js
index 32df12b90ac..4793a77cbcb 100644
--- a/lib/BannerPlugin.js
+++ b/lib/BannerPlugin.js
@@ -5,18 +5,32 @@
"use strict";
-const { validate } = require("schema-utils");
const { ConcatSource } = require("webpack-sources");
const Compilation = require("./Compilation");
const ModuleFilenameHelpers = require("./ModuleFilenameHelpers");
const Template = require("./Template");
+const createSchemaValidation = require("./util/create-schema-validation");
-const schema = require("../schemas/plugins/BannerPlugin.json");
-
+/** @typedef {import("../declarations/plugins/BannerPlugin").BannerFunction} BannerFunction */
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginArgument} BannerPluginArgument */
/** @typedef {import("../declarations/plugins/BannerPlugin").BannerPluginOptions} BannerPluginOptions */
+/** @typedef {import("./Compilation").PathData} PathData */
/** @typedef {import("./Compiler")} Compiler */
+/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
+
+const validate = createSchemaValidation(
+ require("../schemas/plugins/BannerPlugin.check.js"),
+ () => require("../schemas/plugins/BannerPlugin.json"),
+ {
+ name: "Banner Plugin",
+ baseDataPath: "options"
+ }
+);
+/**
+ * @param {string} str string to wrap
+ * @returns {string} wrapped string
+ */
const wrapComment = str => {
if (!str.includes("\n")) {
return Template.toComment(str);
@@ -26,7 +40,7 @@ const wrapComment = str => {
.split("\n")
.join("\n * ")
.replace(/\s+\n/g, "\n")
- .trimRight()}\n */`;
+ .trimEnd()}\n */`;
};
class BannerPlugin {
@@ -40,23 +54,22 @@ class BannerPlugin {
};
}
- validate(schema, options, {
- name: "Banner Plugin",
- baseDataPath: "options"
- });
+ validate(options);
this.options = options;
const bannerOption = options.banner;
if (typeof bannerOption === "function") {
const getBanner = bannerOption;
+ /** @type {BannerFunction} */
this.banner = this.options.raw
? getBanner
- : data => wrapComment(getBanner(data));
+ : /** @type {BannerFunction} */ data => wrapComment(getBanner(data));
} else {
const banner = this.options.raw
? bannerOption
: wrapComment(bannerOption);
+ /** @type {BannerFunction} */
this.banner = () => banner;
}
}
@@ -73,12 +86,15 @@ class BannerPlugin {
undefined,
options
);
+ const cache = new WeakMap();
+ const stage =
+ this.options.stage || Compilation.PROCESS_ASSETS_STAGE_ADDITIONS;
compiler.hooks.compilation.tap("BannerPlugin", compilation => {
compilation.hooks.processAssets.tap(
{
name: "BannerPlugin",
- stage: Compilation.PROCESS_ASSETS_STAGE_ADDITIONS
+ stage
},
() => {
for (const chunk of compilation.chunks) {
@@ -91,17 +107,26 @@ class BannerPlugin {
continue;
}
- const data = {
- chunk,
- filename: file
- };
+ /** @type {PathData} */
+ const data = { chunk, filename: file };
- const comment = compilation.getPath(banner, data);
-
- compilation.updateAsset(
- file,
- old => new ConcatSource(comment, "\n", old)
+ const comment = compilation.getPath(
+ /** @type {TemplatePath} */
+ (banner),
+ data
);
+
+ compilation.updateAsset(file, old => {
+ const cached = cache.get(old);
+ if (!cached || cached.comment !== comment) {
+ const source = options.footer
+ ? new ConcatSource(old, "\n", comment)
+ : new ConcatSource(comment, "\n", old);
+ cache.set(old, { source, comment });
+ return source;
+ }
+ return cached.source;
+ });
}
}
}
diff --git a/lib/Cache.js b/lib/Cache.js
index 2f553bef93c..055ad6d225a 100644
--- a/lib/Cache.js
+++ b/lib/Cache.js
@@ -14,14 +14,14 @@ const {
/** @typedef {import("./WebpackError")} WebpackError */
/**
- * @typedef {Object} Etag
+ * @typedef {object} Etag
* @property {function(): string} toString
*/
/**
* @template T
* @callback CallbackCache
- * @param {WebpackError=} err
+ * @param {WebpackError | null} err
* @param {T=} result
* @returns {void}
*/
@@ -33,16 +33,19 @@ const {
* @returns {void}
*/
-const needCalls = (times, callback) => {
- return err => {
- if (--times === 0) {
- return callback(err);
- }
- if (err && times > 0) {
- times = 0;
- return callback(err);
- }
- };
+/**
+ * @param {number} times times
+ * @param {function(Error=): void} callback callback
+ * @returns {function(Error=): void} callback
+ */
+const needCalls = (times, callback) => err => {
+ if (--times === 0) {
+ return callback(err);
+ }
+ if (err && times > 0) {
+ times = 0;
+ return callback(err);
+ }
};
class Cache {
@@ -71,6 +74,7 @@ class Cache {
* @returns {void}
*/
get(identifier, etag, callback) {
+ /** @type {GotHandler[]} */
const gotHandlers = [];
this.hooks.get.callAsync(identifier, etag, gotHandlers, (err, result) => {
if (err) {
diff --git a/lib/CacheFacade.js b/lib/CacheFacade.js
index c8d1e9b8d28..eece9631735 100644
--- a/lib/CacheFacade.js
+++ b/lib/CacheFacade.js
@@ -5,6 +5,7 @@
"use strict";
+const { forEachBail } = require("enhanced-resolve");
const asyncLib = require("neo-async");
const getLazyHashedEtag = require("./cache/getLazyHashedEtag");
const mergeEtags = require("./cache/mergeEtags");
@@ -13,19 +14,20 @@ const mergeEtags = require("./cache/mergeEtags");
/** @typedef {import("./Cache").Etag} Etag */
/** @typedef {import("./WebpackError")} WebpackError */
/** @typedef {import("./cache/getLazyHashedEtag").HashableObject} HashableObject */
+/** @typedef {typeof import("./util/Hash")} HashConstructor */
/**
* @template T
* @callback CallbackCache
- * @param {WebpackError=} err
- * @param {T=} result
+ * @param {(Error | null)=} err
+ * @param {(T | null)=} result
* @returns {void}
*/
/**
* @template T
* @callback CallbackNormalErrorCache
- * @param {Error=} err
+ * @param {(Error | null)=} err
* @param {T=} result
* @returns {void}
*/
@@ -36,6 +38,7 @@ class MultiItemCache {
*/
constructor(items) {
this._items = items;
+ // eslint-disable-next-line no-constructor-return
if (items.length === 1) return /** @type {any} */ (items[0]);
}
@@ -45,15 +48,7 @@ class MultiItemCache {
* @returns {void}
*/
get(callback) {
- const next = i => {
- this._items[i].get((err, result) => {
- if (err) return callback(err);
- if (result !== undefined) return callback(null, result);
- if (++i >= this._items.length) return callback();
- next(i);
- });
- };
- next(0);
+ forEachBail(this._items, (item, callback) => item.get(callback), callback);
}
/**
@@ -61,12 +56,15 @@ class MultiItemCache {
* @returns {Promise} promise with the data
*/
getPromise() {
- const next = i => {
- return this._items[i].getPromise().then(result => {
+ /**
+ * @param {number} i index
+ * @returns {Promise} promise with the data
+ */
+ const next = i =>
+ this._items[i].getPromise().then(result => {
if (result !== undefined) return result;
if (++i < this._items.length) return next(i);
});
- };
return next(0);
}
@@ -90,9 +88,9 @@ class MultiItemCache {
* @returns {Promise} promise signals when the value is stored
*/
storePromise(data) {
- return Promise.all(
- this._items.map(item => item.storePromise(data))
- ).then(() => {});
+ return Promise.all(this._items.map(item => item.storePromise(data))).then(
+ () => {}
+ );
}
}
@@ -198,10 +196,12 @@ class CacheFacade {
/**
* @param {Cache} cache the root cache
* @param {string} name the child cache name
+ * @param {(string | HashConstructor)=} hashFunction the hash function to use
*/
- constructor(cache, name) {
+ constructor(cache, name, hashFunction) {
this._cache = cache;
this._name = name;
+ this._hashFunction = hashFunction;
}
/**
@@ -209,7 +209,11 @@ class CacheFacade {
* @returns {CacheFacade} child cache
*/
getChildCache(name) {
- return new CacheFacade(this._cache, `${this._name}|${name}`);
+ return new CacheFacade(
+ this._cache,
+ `${this._name}|${name}`,
+ this._hashFunction
+ );
}
/**
@@ -230,7 +234,7 @@ class CacheFacade {
* @returns {Etag} an etag that is lazy hashed
*/
getLazyHashedEtag(obj) {
- return getLazyHashedEtag(obj);
+ return getLazyHashedEtag(obj, this._hashFunction);
}
/**
diff --git a/lib/CaseSensitiveModulesWarning.js b/lib/CaseSensitiveModulesWarning.js
index 65898f4d830..58a38e5506e 100644
--- a/lib/CaseSensitiveModulesWarning.js
+++ b/lib/CaseSensitiveModulesWarning.js
@@ -14,8 +14,8 @@ const WebpackError = require("./WebpackError");
* @param {Module[]} modules the modules to be sorted
* @returns {Module[]} sorted version of original modules
*/
-const sortModules = modules => {
- return modules.slice().sort((a, b) => {
+const sortModules = modules =>
+ modules.sort((a, b) => {
const aIdent = a.identifier();
const bIdent = b.identifier();
/* istanbul ignore next */
@@ -25,38 +25,38 @@ const sortModules = modules => {
/* istanbul ignore next */
return 0;
});
-};
/**
* @param {Module[]} modules each module from throw
* @param {ModuleGraph} moduleGraph the module graph
* @returns {string} each message from provided modules
*/
-const createModulesListMessage = (modules, moduleGraph) => {
- return modules
+const createModulesListMessage = (modules, moduleGraph) =>
+ modules
.map(m => {
let message = `* ${m.identifier()}`;
const validReasons = Array.from(
moduleGraph.getIncomingConnectionsByOriginModule(m).keys()
- ).filter(x => x);
+ ).filter(Boolean);
if (validReasons.length > 0) {
message += `\n Used by ${validReasons.length} module(s), i. e.`;
- message += `\n ${validReasons[0].identifier()}`;
+ message += `\n ${
+ /** @type {Module[]} */ (validReasons)[0].identifier()
+ }`;
}
return message;
})
.join("\n");
-};
class CaseSensitiveModulesWarning extends WebpackError {
/**
* Creates an instance of CaseSensitiveModulesWarning.
- * @param {Module[]} modules modules that were detected
+ * @param {Iterable} modules modules that were detected
* @param {ModuleGraph} moduleGraph the module graph
*/
constructor(modules, moduleGraph) {
- const sortedModules = sortModules(modules);
+ const sortedModules = sortModules(Array.from(modules));
const modulesList = createModulesListMessage(sortedModules, moduleGraph);
super(`There are multiple modules with names that only differ in casing.
This can lead to unexpected behavior when compiling on a filesystem with other case-semantic.
@@ -65,8 +65,6 @@ ${modulesList}`);
this.name = "CaseSensitiveModulesWarning";
this.module = sortedModules[0];
-
- Error.captureStackTrace(this, this.constructor);
}
}
diff --git a/lib/Chunk.js b/lib/Chunk.js
index ae8ac32a37f..3b1b93c00b2 100644
--- a/lib/Chunk.js
+++ b/lib/Chunk.js
@@ -22,26 +22,30 @@ const { mergeRuntime } = require("./util/runtime");
/** @typedef {import("./ChunkGraph").ChunkFilterPredicate} ChunkFilterPredicate */
/** @typedef {import("./ChunkGraph").ChunkSizeOptions} ChunkSizeOptions */
/** @typedef {import("./ChunkGraph").ModuleFilterPredicate} ModuleFilterPredicate */
+/** @typedef {import("./ChunkGraph").ModuleId} ModuleId */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
+/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
-/** @typedef {import("./Compilation").PathData} PathData */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
+/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
/** @typedef {import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
+/** @typedef {number | string} ChunkId */
+
const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files");
/**
- * @typedef {Object} WithId an object who has an id property *
+ * @typedef {object} WithId an object who has an id property *
* @property {string | number} id the id of the object
*/
/**
* @deprecated
- * @typedef {Object} ChunkMaps
+ * @typedef {object} ChunkMaps
* @property {Record} hash
* @property {Record>} contentHash
* @property {Record} name
@@ -49,7 +53,7 @@ const ChunkFilesSet = createArrayToSetDeprecationSet("chunk.files");
/**
* @deprecated
- * @typedef {Object} ChunkModuleMaps
+ * @typedef {object} ChunkModuleMaps
* @property {Record} id
* @property {Record} hash
*/
@@ -63,28 +67,34 @@ let debugId = 1000;
class Chunk {
/**
* @param {string=} name of chunk being created, is optional (for subclasses)
+ * @param {boolean} backCompat enable backward-compatibility
*/
- constructor(name) {
- /** @type {number | string | null} */
+ constructor(name, backCompat = true) {
+ /** @type {ChunkId | null} */
this.id = null;
- /** @type {(number|string)[] | null} */
+ /** @type {ChunkId[] | null} */
this.ids = null;
/** @type {number} */
this.debugId = debugId++;
- /** @type {string} */
+ /** @type {string | undefined} */
this.name = name;
/** @type {SortableSet} */
this.idNameHints = new SortableSet();
/** @type {boolean} */
this.preventIntegration = false;
- /** @type {(string | function(PathData, AssetInfo=): string)?} */
+ /** @type {TemplatePath | undefined} */
this.filenameTemplate = undefined;
- /** @private @type {SortableSet} */
+ /** @type {TemplatePath | undefined} */
+ this.cssFilenameTemplate = undefined;
+ /**
+ * @private
+ * @type {SortableSet}
+ */
this._groups = new SortableSet(undefined, compareChunkGroupsByIndex);
/** @type {RuntimeSpec} */
this.runtime = undefined;
/** @type {Set} */
- this.files = new ChunkFilesSet();
+ this.files = backCompat ? new ChunkFilesSet() : new Set();
/** @type {Set} */
this.auxiliaryFiles = new Set();
/** @type {boolean} */
@@ -115,11 +125,11 @@ class Chunk {
return undefined;
} else if (entryModules.length === 1) {
return entryModules[0];
- } else {
- throw new Error(
- "Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)"
- );
}
+
+ throw new Error(
+ "Module.entryModule: Multiple entry modules are not supported by the deprecated API (Use the new ChunkGroup API)"
+ );
}
/**
@@ -262,9 +272,9 @@ class Chunk {
if (chunkGraph.canChunksBeIntegrated(this, otherChunk)) {
chunkGraph.integrateChunks(this, otherChunk);
return true;
- } else {
- return false;
}
+
+ return false;
}
/**
@@ -347,7 +357,7 @@ class Chunk {
const chunkModuleHashMap = Object.create(null);
for (const asyncChunk of this.getAllAsyncChunks()) {
- /** @type {(string|number)[]} */
+ /** @type {ChunkId[] | undefined} */
let array;
for (const module of chunkGraph.getOrderedChunkModulesIterable(
asyncChunk,
@@ -356,9 +366,11 @@ class Chunk {
if (filterFn(module)) {
if (array === undefined) {
array = [];
- chunkModuleIdMap[asyncChunk.id] = array;
+ chunkModuleIdMap[/** @type {ChunkId} */ (asyncChunk.id)] = array;
}
- const moduleId = chunkGraph.getModuleId(module);
+ const moduleId =
+ /** @type {ModuleId} */
+ (chunkGraph.getModuleId(module));
array.push(moduleId);
chunkModuleHashMap[moduleId] = chunkGraph.getRenderedModuleHash(
module,
@@ -402,15 +414,18 @@ class Chunk {
const chunkNameMap = Object.create(null);
for (const chunk of this.getAllAsyncChunks()) {
- chunkHashMap[chunk.id] = realHash ? chunk.hash : chunk.renderedHash;
+ const id = /** @type {ChunkId} */ (chunk.id);
+ chunkHashMap[id] =
+ /** @type {string} */
+ (realHash ? chunk.hash : chunk.renderedHash);
for (const key of Object.keys(chunk.contentHash)) {
if (!chunkContentHashMap[key]) {
chunkContentHashMap[key] = Object.create(null);
}
- chunkContentHashMap[key][chunk.id] = chunk.contentHash[key];
+ chunkContentHashMap[key][id] = chunk.contentHash[key];
}
if (chunk.name) {
- chunkNameMap[chunk.id] = chunk.name;
+ chunkNameMap[id] = chunk.name;
}
}
@@ -502,7 +517,7 @@ class Chunk {
}
/**
- * @returns {Iterable} the chunkGroups that the said chunk is referenced in
+ * @returns {SortableSet} the chunkGroups that the said chunk is referenced in
*/
get groupsIterable() {
this._groups.sort();
@@ -539,21 +554,22 @@ class Chunk {
* @returns {void}
*/
updateHash(hash, chunkGraph) {
- hash.update(`${this.id} `);
- hash.update(this.ids ? this.ids.join(",") : "");
- hash.update(`${this.name || ""} `);
+ hash.update(
+ `${this.id} ${this.ids ? this.ids.join() : ""} ${this.name || ""} `
+ );
const xor = new StringXor();
for (const m of chunkGraph.getChunkModulesIterable(this)) {
xor.add(chunkGraph.getModuleHash(m, this.runtime));
}
xor.updateHash(hash);
- const entryModules = chunkGraph.getChunkEntryModulesWithChunkGroupIterable(
- this
- );
+ const entryModules =
+ chunkGraph.getChunkEntryModulesWithChunkGroupIterable(this);
for (const [m, chunkGroup] of entryModules) {
- hash.update("entry");
- hash.update(`${chunkGraph.getModuleId(m)}`);
- hash.update(chunkGroup.id);
+ hash.update(
+ `entry${chunkGraph.getModuleId(m)}${
+ /** @type {ChunkGroup} */ (chunkGroup).id
+ }`
+ );
}
}
@@ -568,9 +584,15 @@ class Chunk {
Array.from(this.groupsIterable, g => new Set(g.chunks))
);
- for (const chunkGroup of this.groupsIterable) {
+ const initialQueue = new Set(this.groupsIterable);
+
+ for (const chunkGroup of initialQueue) {
for (const child of chunkGroup.childrenIterable) {
- queue.add(child);
+ if (child instanceof Entrypoint) {
+ initialQueue.add(child);
+ } else {
+ queue.add(child);
+ }
}
}
@@ -593,8 +615,12 @@ class Chunk {
*/
getAllInitialChunks() {
const chunks = new Set();
- for (const group of this.groupsIterable) {
- for (const c of group.chunks) chunks.add(c);
+ const queue = new Set(this.groupsIterable);
+ for (const group of queue) {
+ if (group.isInitial()) {
+ for (const c of group.chunks) chunks.add(c);
+ for (const g of group.childrenIterable) queue.add(g);
+ }
}
return chunks;
}
@@ -680,14 +706,20 @@ class Chunk {
for (const childGroup of group.childrenIterable) {
for (const key of Object.keys(childGroup.options)) {
if (key.endsWith("Order")) {
- const name = key.substr(0, key.length - "Order".length);
+ const name = key.slice(0, key.length - "Order".length);
let list = lists.get(name);
if (list === undefined) {
list = [];
lists.set(name, list);
}
list.push({
- order: childGroup.options[key],
+ order:
+ /** @type {number} */
+ (
+ childGroup.options[
+ /** @type {keyof ChunkGroupOptions} */ (key)
+ ]
+ ),
group: childGroup
});
}
@@ -708,7 +740,7 @@ class Chunk {
for (const item of list) {
for (const chunk of item.group.chunks) {
if (filterFn && !filterFn(chunk, chunkGraph)) continue;
- chunkIdSet.add(chunk.id);
+ chunkIdSet.add(/** @type {ChunkId} */ (chunk.id));
}
}
if (chunkIdSet.size > 0) {
@@ -721,13 +753,14 @@ class Chunk {
/**
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {string} type option name
- * @returns {{ onChunks: Chunk[], chunks: Set }[]} referenced chunks for a specific type
+ * @returns {{ onChunks: Chunk[], chunks: Set }[] | undefined} referenced chunks for a specific type
*/
getChildrenOfTypeInOrder(chunkGraph, type) {
const list = [];
for (const group of this.groupsIterable) {
for (const childGroup of group.childrenIterable) {
- const order = childGroup.options[type];
+ const order =
+ childGroup.options[/** @type {keyof ChunkGroupOptions} */ (type)];
if (order === undefined) continue;
list.push({
order,
@@ -736,9 +769,10 @@ class Chunk {
});
}
}
- if (list.length === 0) return undefined;
+ if (list.length === 0) return;
list.sort((a, b) => {
- const cmp = b.order - a.order;
+ const cmp =
+ /** @type {number} */ (b.order) - /** @type {number} */ (a.order);
if (cmp !== 0) return cmp;
return a.group.compareTo(chunkGraph, b.group);
});
@@ -782,7 +816,7 @@ class Chunk {
if (chunkMap === undefined) {
chunkMaps[key] = chunkMap = Object.create(null);
}
- chunkMap[chunk.id] = data[key];
+ chunkMap[/** @type {ChunkId} */ (chunk.id)] = data[key];
}
};
diff --git a/lib/ChunkGraph.js b/lib/ChunkGraph.js
index b9db3f832e9..462ec9f38af 100644
--- a/lib/ChunkGraph.js
+++ b/lib/ChunkGraph.js
@@ -6,10 +6,10 @@
"use strict";
const util = require("util");
+const Entrypoint = require("./Entrypoint");
const ModuleGraphConnection = require("./ModuleGraphConnection");
const { first } = require("./util/SetHelpers");
const SortableSet = require("./util/SortableSet");
-const StringXor = require("./util/StringXor");
const {
compareModulesById,
compareIterables,
@@ -30,28 +30,37 @@ const {
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
/** @typedef {import("./Chunk")} Chunk */
+/** @typedef {import("./Chunk").ChunkId} ChunkId */
/** @typedef {import("./ChunkGroup")} ChunkGroup */
-/** @typedef {import("./Entrypoint")} Entrypoint */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./ModuleGraph")} ModuleGraph */
+/** @typedef {import("./ModuleGraphConnection").ConnectionState} ConnectionState */
/** @typedef {import("./RuntimeModule")} RuntimeModule */
+/** @typedef {typeof import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
/** @type {ReadonlySet} */
const EMPTY_SET = new Set();
+const ZERO_BIG_INT = BigInt(0);
+
const compareModuleIterables = compareIterables(compareModulesByIdentifier);
/** @typedef {(c: Chunk, chunkGraph: ChunkGraph) => boolean} ChunkFilterPredicate */
/** @typedef {(m: Module) => boolean} ModuleFilterPredicate */
+/** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */
/**
- * @typedef {Object} ChunkSizeOptions
+ * @typedef {object} ChunkSizeOptions
* @property {number=} chunkOverhead constant overhead for a chunk
* @property {number=} entryChunkMultiplicator multiplicator for initial chunks
*/
class ModuleHashInfo {
+ /**
+ * @param {string} hash hash
+ * @param {string} renderedHash rendered hash
+ */
constructor(hash, renderedHash) {
this.hash = hash;
this.renderedHash = renderedHash;
@@ -65,9 +74,7 @@ class ModuleHashInfo {
* @param {SortableSet} set the set
* @returns {T[]} set as array
*/
-const getArray = set => {
- return Array.from(set);
-};
+const getArray = set => Array.from(set);
/**
* @param {SortableSet} chunks the chunks
@@ -82,14 +89,17 @@ const getModuleRuntimes = chunks => {
};
/**
- * @param {SortableSet} set the set
- * @returns {Map>} modules by source type
+ * @param {WeakMap> | undefined} sourceTypesByModule sourceTypesByModule
+ * @returns {function (SortableSet): Map>} modules by source type
*/
-const modulesBySourceType = set => {
+const modulesBySourceType = sourceTypesByModule => set => {
/** @type {Map>} */
const map = new Map();
for (const module of set) {
- for (const sourceType of module.getSourceTypes()) {
+ const sourceTypes =
+ (sourceTypesByModule && sourceTypesByModule.get(module)) ||
+ module.getSourceTypes();
+ for (const sourceType of sourceTypes) {
let innerSet = map.get(sourceType);
if (innerSet === undefined) {
innerSet = new SortableSet();
@@ -107,6 +117,7 @@ const modulesBySourceType = set => {
}
return map;
};
+const defaultModulesBySourceType = modulesBySourceType(undefined);
/** @type {WeakMap} */
const createOrderedArrayFunctionMap = new WeakMap();
@@ -147,7 +158,7 @@ const getModulesSize = modules => {
* @returns {Record} the sizes of the modules
*/
const getModulesSizes = modules => {
- let sizes = Object.create(null);
+ const sizes = Object.create(null);
for (const module of modules) {
for (const type of module.getSourceTypes()) {
sizes[type] = (sizes[type] || 0) + module.size(type);
@@ -173,23 +184,27 @@ const isAvailableChunk = (a, b) => {
return true;
};
+/** @typedef {Set} EntryInChunks */
+/** @typedef {Set} RuntimeInChunks */
+/** @typedef {string | number} ModuleId */
+
class ChunkGraphModule {
constructor() {
/** @type {SortableSet} */
this.chunks = new SortableSet();
- /** @type {Set | undefined} */
+ /** @type {EntryInChunks | undefined} */
this.entryInChunks = undefined;
- /** @type {Set | undefined} */
+ /** @type {RuntimeInChunks | undefined} */
this.runtimeInChunks = undefined;
- /** @type {RuntimeSpecMap} */
+ /** @type {RuntimeSpecMap | undefined} */
this.hashes = undefined;
- /** @type {string | number} */
+ /** @type {ModuleId | null} */
this.id = null;
/** @type {RuntimeSpecMap> | undefined} */
this.runtimeRequirements = undefined;
- /** @type {RuntimeSpecMap} */
+ /** @type {RuntimeSpecMap | undefined} */
this.graphHashes = undefined;
- /** @type {RuntimeSpecMap} */
+ /** @type {RuntimeSpecMap | undefined} */
this.graphHashesWithConnections = undefined;
}
}
@@ -198,46 +213,57 @@ class ChunkGraphChunk {
constructor() {
/** @type {SortableSet} */
this.modules = new SortableSet();
+ /** @type {WeakMap> | undefined} */
+ this.sourceTypesByModule = undefined;
/** @type {Map} */
this.entryModules = new Map();
/** @type {SortableSet} */
this.runtimeModules = new SortableSet();
/** @type {Set | undefined} */
this.fullHashModules = undefined;
+ /** @type {Set | undefined} */
+ this.dependentHashModules = undefined;
/** @type {Set | undefined} */
this.runtimeRequirements = undefined;
/** @type {Set} */
this.runtimeRequirementsInTree = new Set();
+
+ this._modulesBySourceType = defaultModulesBySourceType;
}
}
class ChunkGraph {
/**
* @param {ModuleGraph} moduleGraph the module graph
+ * @param {string | Hash} hashFunction the hash function to use
*/
- constructor(moduleGraph) {
- /** @private @type {WeakMap} */
+ constructor(moduleGraph, hashFunction = "md4") {
+ /**
+ * @private
+ * @type {WeakMap}
+ */
this._modules = new WeakMap();
- /** @private @type {WeakMap} */
+ /**
+ * @private
+ * @type {WeakMap}
+ */
this._chunks = new WeakMap();
- /** @private @type {WeakMap} */
+ /**
+ * @private
+ * @type {WeakMap}
+ */
this._blockChunkGroups = new WeakMap();
- /** @private @type {Map} */
+ /**
+ * @private
+ * @type {Map}
+ */
this._runtimeIds = new Map();
/** @type {ModuleGraph} */
this.moduleGraph = moduleGraph;
- this._getGraphRoots = this._getGraphRoots.bind(this);
+ this._hashFunction = hashFunction;
- // Caching
- this._cacheChunkGraphModuleKey1 = undefined;
- this._cacheChunkGraphModuleValue1 = undefined;
- this._cacheChunkGraphModuleKey2 = undefined;
- this._cacheChunkGraphModuleValue2 = undefined;
- this._cacheChunkGraphChunkKey1 = undefined;
- this._cacheChunkGraphChunkValue1 = undefined;
- this._cacheChunkGraphChunkKey2 = undefined;
- this._cacheChunkGraphChunkValue2 = undefined;
+ this._getGraphRoots = this._getGraphRoots.bind(this);
}
/**
@@ -246,19 +272,11 @@ class ChunkGraph {
* @returns {ChunkGraphModule} internal module
*/
_getChunkGraphModule(module) {
- if (this._cacheChunkGraphModuleKey1 === module)
- return this._cacheChunkGraphModuleValue1;
- if (this._cacheChunkGraphModuleKey2 === module)
- return this._cacheChunkGraphModuleValue2;
let cgm = this._modules.get(module);
if (cgm === undefined) {
cgm = new ChunkGraphModule();
this._modules.set(module, cgm);
}
- this._cacheChunkGraphModuleKey2 = this._cacheChunkGraphModuleKey1;
- this._cacheChunkGraphModuleValue2 = this._cacheChunkGraphModuleValue1;
- this._cacheChunkGraphModuleKey1 = module;
- this._cacheChunkGraphModuleValue1 = cgm;
return cgm;
}
@@ -268,19 +286,11 @@ class ChunkGraph {
* @returns {ChunkGraphChunk} internal chunk
*/
_getChunkGraphChunk(chunk) {
- if (this._cacheChunkGraphChunkKey1 === chunk)
- return this._cacheChunkGraphChunkValue1;
- if (this._cacheChunkGraphChunkKey2 === chunk)
- return this._cacheChunkGraphChunkValue2;
let cgc = this._chunks.get(chunk);
if (cgc === undefined) {
cgc = new ChunkGraphChunk();
this._chunks.set(chunk, cgc);
}
- this._cacheChunkGraphChunkKey2 = this._cacheChunkGraphChunkKey1;
- this._cacheChunkGraphChunkValue2 = this._cacheChunkGraphChunkValue1;
- this._cacheChunkGraphChunkKey1 = chunk;
- this._cacheChunkGraphChunkValue1 = cgc;
return cgc;
}
@@ -294,6 +304,9 @@ class ChunkGraph {
findGraphRoots(set, module => {
/** @type {Set} */
const set = new Set();
+ /**
+ * @param {Module} module module
+ */
const addDependencies = module => {
for (const connection of moduleGraph.getOutgoingConnections(module)) {
if (!connection.module) continue;
@@ -333,6 +346,8 @@ class ChunkGraph {
const cgm = this._getChunkGraphModule(module);
const cgc = this._getChunkGraphChunk(chunk);
cgc.modules.delete(module);
+ // No need to invalidate cgc._modulesBySourceType because we modified cgc.modules anyway
+ if (cgc.sourceTypesByModule) cgc.sourceTypesByModule.delete(module);
cgm.chunks.delete(chunk);
}
@@ -388,6 +403,20 @@ class ChunkGraph {
}
}
+ /**
+ * @param {Chunk} chunk the chunk
+ * @param {Iterable} modules the modules that require a full hash
+ * @returns {void}
+ */
+ attachDependentHashModules(chunk, modules) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ if (cgc.dependentHashModules === undefined)
+ cgc.dependentHashModules = new Set();
+ for (const module of modules) {
+ cgc.dependentHashModules.add(module);
+ }
+ }
+
/**
* @param {Module} oldModule the replaced module
* @param {Module} newModule the replacing module
@@ -411,7 +440,7 @@ class ChunkGraph {
}
for (const chunk of oldCgm.entryInChunks) {
const cgc = this._getChunkGraphChunk(chunk);
- const old = cgc.entryModules.get(oldModule);
+ const old = /** @type {Entrypoint} */ (cgc.entryModules.get(oldModule));
/** @type {Map} */
const newEntryModules = new Map();
for (const [m, cg] of cgc.entryModules) {
@@ -443,6 +472,17 @@ class ChunkGraph {
cgc.fullHashModules.delete(/** @type {RuntimeModule} */ (oldModule));
cgc.fullHashModules.add(/** @type {RuntimeModule} */ (newModule));
}
+ if (
+ cgc.dependentHashModules !== undefined &&
+ cgc.dependentHashModules.has(/** @type {RuntimeModule} */ (oldModule))
+ ) {
+ cgc.dependentHashModules.delete(
+ /** @type {RuntimeModule} */ (oldModule)
+ );
+ cgc.dependentHashModules.add(
+ /** @type {RuntimeModule} */ (newModule)
+ );
+ }
}
oldCgm.runtimeInChunks = undefined;
}
@@ -528,13 +568,22 @@ class ChunkGraph {
/**
* @param {Chunk} chunk the chunk
- * @returns {number} the number of module which are contained in this chunk
+ * @returns {number} the number of modules which are contained in this chunk
*/
getNumberOfChunkModules(chunk) {
const cgc = this._getChunkGraphChunk(chunk);
return cgc.modules.size;
}
+ /**
+ * @param {Chunk} chunk the chunk
+ * @returns {number} the number of full hash modules which are contained in this chunk
+ */
+ getNumberOfChunkFullHashModules(chunk) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ return cgc.fullHashModules === undefined ? 0 : cgc.fullHashModules.size;
+ }
+
/**
* @param {Chunk} chunk the chunk
* @returns {Iterable} return the modules for this chunk
@@ -552,11 +601,84 @@ class ChunkGraph {
getChunkModulesIterableBySourceType(chunk, sourceType) {
const cgc = this._getChunkGraphChunk(chunk);
const modulesWithSourceType = cgc.modules
- .getFromUnorderedCache(modulesBySourceType)
+ .getFromUnorderedCache(cgc._modulesBySourceType)
.get(sourceType);
return modulesWithSourceType;
}
+ /**
+ * @param {Chunk} chunk chunk
+ * @param {Module} module chunk module
+ * @param {Set} sourceTypes source types
+ */
+ setChunkModuleSourceTypes(chunk, module, sourceTypes) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ if (cgc.sourceTypesByModule === undefined) {
+ cgc.sourceTypesByModule = new WeakMap();
+ }
+ cgc.sourceTypesByModule.set(module, sourceTypes);
+ // Update cgc._modulesBySourceType to invalidate the cache
+ cgc._modulesBySourceType = modulesBySourceType(cgc.sourceTypesByModule);
+ }
+
+ /**
+ * @param {Chunk} chunk chunk
+ * @param {Module} module chunk module
+ * @returns {Set} source types
+ */
+ getChunkModuleSourceTypes(chunk, module) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ if (cgc.sourceTypesByModule === undefined) {
+ return module.getSourceTypes();
+ }
+ return cgc.sourceTypesByModule.get(module) || module.getSourceTypes();
+ }
+
+ /**
+ * @param {Module} module module
+ * @returns {Set} source types
+ */
+ getModuleSourceTypes(module) {
+ return (
+ this._getOverwrittenModuleSourceTypes(module) || module.getSourceTypes()
+ );
+ }
+
+ /**
+ * @param {Module} module module
+ * @returns {Set | undefined} source types
+ */
+ _getOverwrittenModuleSourceTypes(module) {
+ let newSet = false;
+ let sourceTypes;
+ for (const chunk of this.getModuleChunksIterable(module)) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ if (cgc.sourceTypesByModule === undefined) return;
+ const st = cgc.sourceTypesByModule.get(module);
+ if (st === undefined) return;
+ if (!sourceTypes) {
+ sourceTypes = st;
+ continue;
+ } else if (!newSet) {
+ for (const type of st) {
+ if (!newSet) {
+ if (!sourceTypes.has(type)) {
+ newSet = true;
+ sourceTypes = new Set(sourceTypes);
+ sourceTypes.add(type);
+ }
+ } else {
+ sourceTypes.add(type);
+ }
+ }
+ } else {
+ for (const type of st) sourceTypes.add(type);
+ }
+ }
+
+ return sourceTypes;
+ }
+
/**
* @param {Chunk} chunk the chunk
* @param {function(Module, Module): -1|0|1} comparator comparator function
@@ -577,9 +699,9 @@ class ChunkGraph {
getOrderedChunkModulesIterableBySourceType(chunk, sourceType, comparator) {
const cgc = this._getChunkGraphChunk(chunk);
const modulesWithSourceType = cgc.modules
- .getFromUnorderedCache(modulesBySourceType)
+ .getFromUnorderedCache(cgc._modulesBySourceType)
.get(sourceType);
- if (modulesWithSourceType === undefined) return undefined;
+ if (modulesWithSourceType === undefined) return;
modulesWithSourceType.sortWith(comparator);
return modulesWithSourceType;
}
@@ -617,7 +739,7 @@ class ChunkGraph {
for (const asyncChunk of includeAllChunks
? chunk.getAllReferencedChunks()
: chunk.getAllAsyncChunks()) {
- /** @type {(string|number)[]} */
+ /** @type {(string | number)[] | undefined} */
let array;
for (const module of this.getOrderedChunkModulesIterable(
asyncChunk,
@@ -626,9 +748,9 @@ class ChunkGraph {
if (filterFn(module)) {
if (array === undefined) {
array = [];
- chunkModuleIdMap[asyncChunk.id] = array;
+ chunkModuleIdMap[/** @type {ChunkId} */ (asyncChunk.id)] = array;
}
- const moduleId = this.getModuleId(module);
+ const moduleId = /** @type {ModuleId} */ (this.getModuleId(module));
array.push(moduleId);
}
}
@@ -650,13 +772,15 @@ class ChunkGraph {
hashLength = 0,
includeAllChunks = false
) {
- /** @type {Record>} */
+ /** @type {Record>} */
const chunkModuleHashMap = Object.create(null);
+ /** @typedef {Record} IdToHashMap */
+
for (const asyncChunk of includeAllChunks
? chunk.getAllReferencedChunks()
: chunk.getAllAsyncChunks()) {
- /** @type {Record} */
+ /** @type {IdToHashMap | undefined} */
let idToHashMap;
for (const module of this.getOrderedChunkModulesIterable(
asyncChunk,
@@ -665,11 +789,15 @@ class ChunkGraph {
if (filterFn(module)) {
if (idToHashMap === undefined) {
idToHashMap = Object.create(null);
- chunkModuleHashMap[asyncChunk.id] = idToHashMap;
+ chunkModuleHashMap[/** @type {ChunkId} */ (asyncChunk.id)] =
+ /** @type {IdToHashMap} */ (idToHashMap);
}
const moduleId = this.getModuleId(module);
const hash = this.getRenderedModuleHash(module, asyncChunk.runtime);
- idToHashMap[moduleId] = hashLength ? hash.slice(0, hashLength) : hash;
+ /** @type {IdToHashMap} */
+ (idToHashMap)[/** @type {ModuleId} */ (moduleId)] = hashLength
+ ? hash.slice(0, hashLength)
+ : hash;
}
}
}
@@ -685,7 +813,7 @@ class ChunkGraph {
getChunkConditionMap(chunk, filterFn) {
const map = Object.create(null);
for (const c of chunk.getAllReferencedChunks()) {
- map[c.id] = filterFn(c, this);
+ map[/** @type {ChunkId} */ (c.id)] = filterFn(c, this);
}
return map;
}
@@ -793,7 +921,7 @@ class ChunkGraph {
const cgcB = this._getChunkGraphChunk(chunkB);
const allModules = new Set(cgcA.modules);
for (const m of cgcB.modules) allModules.add(m);
- let modulesSize = getModulesSize(allModules);
+ const modulesSize = getModulesSize(allModules);
const chunkOverhead =
typeof options.chunkOverhead === "number" ? options.chunkOverhead : 10000;
const entryChunkMultiplicator =
@@ -827,9 +955,9 @@ class ChunkGraph {
return isAvailableChunk(chunkA, chunkB);
} else if (hasRuntimeB) {
return isAvailableChunk(chunkB, chunkA);
- } else {
- return false;
}
+
+ return false;
}
if (
@@ -888,7 +1016,12 @@ class ChunkGraph {
this.getChunkEntryModulesWithChunkGroupIterable(chunkB)
)) {
this.disconnectChunkAndEntryModule(chunkB, module);
- this.connectChunkAndEntryModule(chunkA, module, chunkGroup);
+ this.connectChunkAndEntryModule(
+ chunkA,
+ module,
+ /** @type {Entrypoint} */
+ (chunkGroup)
+ );
}
for (const chunkGroup of chunkB.groupsIterable) {
@@ -899,6 +1032,23 @@ class ChunkGraph {
ChunkGraph.clearChunkGraphForChunk(chunkB);
}
+ /**
+ * @param {Chunk} chunk the chunk to upgrade
+ * @returns {void}
+ */
+ upgradeDependentToFullHashModules(chunk) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ if (cgc.dependentHashModules === undefined) return;
+ if (cgc.fullHashModules === undefined) {
+ cgc.fullHashModules = cgc.dependentHashModules;
+ } else {
+ for (const m of cgc.dependentHashModules) {
+ cgc.fullHashModules.add(m);
+ }
+ cgc.dependentHashModules = undefined;
+ }
+ }
+
/**
* @param {Module} module the checked module
* @param {Chunk} chunk the checked chunk
@@ -912,7 +1062,7 @@ class ChunkGraph {
/**
* @param {Chunk} chunk the new chunk
* @param {Module} module the entry module
- * @param {Entrypoint=} entrypoint the chunk group which must be loaded before the module is executed
+ * @param {Entrypoint} entrypoint the chunk group which must be loaded before the module is executed
* @returns {void}
*/
connectChunkAndEntryModule(chunk, module, entrypoint) {
@@ -951,6 +1101,18 @@ class ChunkGraph {
cgc.fullHashModules.add(module);
}
+ /**
+ * @param {Chunk} chunk the new chunk
+ * @param {RuntimeModule} module the module that require a full hash
+ * @returns {void}
+ */
+ addDependentHashModuleToChunk(chunk, module) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ if (cgc.dependentHashModules === undefined)
+ cgc.dependentHashModules = new Set();
+ cgc.dependentHashModules.add(module);
+ }
+
/**
* @param {Chunk} chunk the new chunk
* @param {Module} module the entry module
@@ -959,8 +1121,9 @@ class ChunkGraph {
disconnectChunkAndEntryModule(chunk, module) {
const cgm = this._getChunkGraphModule(module);
const cgc = this._getChunkGraphChunk(chunk);
- cgm.entryInChunks.delete(chunk);
- if (cgm.entryInChunks.size === 0) {
+ /** @type {EntryInChunks} */
+ (cgm.entryInChunks).delete(chunk);
+ if (/** @type {EntryInChunks} */ (cgm.entryInChunks).size === 0) {
cgm.entryInChunks = undefined;
}
cgc.entryModules.delete(module);
@@ -974,8 +1137,9 @@ class ChunkGraph {
disconnectChunkAndRuntimeModule(chunk, module) {
const cgm = this._getChunkGraphModule(module);
const cgc = this._getChunkGraphChunk(chunk);
- cgm.runtimeInChunks.delete(chunk);
- if (cgm.runtimeInChunks.size === 0) {
+ /** @type {RuntimeInChunks} */
+ (cgm.runtimeInChunks).delete(chunk);
+ if (/** @type {RuntimeInChunks} */ (cgm.runtimeInChunks).size === 0) {
cgm.runtimeInChunks = undefined;
}
cgc.runtimeModules.delete(module);
@@ -987,7 +1151,7 @@ class ChunkGraph {
*/
disconnectEntryModule(module) {
const cgm = this._getChunkGraphModule(module);
- for (const chunk of cgm.entryInChunks) {
+ for (const chunk of /** @type {EntryInChunks} */ (cgm.entryInChunks)) {
const cgc = this._getChunkGraphChunk(chunk);
cgc.entryModules.delete(module);
}
@@ -1002,8 +1166,9 @@ class ChunkGraph {
const cgc = this._getChunkGraphChunk(chunk);
for (const module of cgc.entryModules.keys()) {
const cgm = this._getChunkGraphModule(module);
- cgm.entryInChunks.delete(chunk);
- if (cgm.entryInChunks.size === 0) {
+ /** @type {EntryInChunks} */
+ (cgm.entryInChunks).delete(chunk);
+ if (/** @type {EntryInChunks} */ (cgm.entryInChunks).size === 0) {
cgm.entryInChunks = undefined;
}
}
@@ -1042,16 +1207,22 @@ class ChunkGraph {
* @returns {Iterable} iterable of chunks
*/
getChunkEntryDependentChunksIterable(chunk) {
- const cgc = this._getChunkGraphChunk(chunk);
/** @type {Set} */
const set = new Set();
- for (const chunkGroup of cgc.entryModules.values()) {
- for (const c of chunkGroup.chunks) {
- if (c !== chunk && !c.hasRuntime()) {
- set.add(c);
+ for (const chunkGroup of chunk.groupsIterable) {
+ if (chunkGroup instanceof Entrypoint) {
+ const entrypointChunk = chunkGroup.getEntrypointChunk();
+ const cgc = this._getChunkGraphChunk(entrypointChunk);
+ for (const chunkGroup of cgc.entryModules.values()) {
+ for (const c of chunkGroup.chunks) {
+ if (c !== chunk && c !== entrypointChunk && !c.hasRuntime()) {
+ set.add(c);
+ }
+ }
}
}
}
+
return set;
}
@@ -1089,14 +1260,7 @@ class ChunkGraph {
const array = Array.from(cgc.runtimeModules);
array.sort(
concatComparators(
- compareSelect(
- /**
- * @param {RuntimeModule} r runtime module
- * @returns {number=} stage
- */
- r => r.stage,
- compareIds
- ),
+ compareSelect(r => /** @type {RuntimeModule} */ (r).stage, compareIds),
compareModulesByIdentifier
)
);
@@ -1121,7 +1285,14 @@ class ChunkGraph {
return cgc.fullHashModules;
}
- /** @typedef {[Module, Entrypoint | undefined]} EntryModuleWithChunkGroup */
+ /**
+ * @param {Chunk} chunk the chunk
+ * @returns {Iterable | undefined} iterable of modules (do not modify)
+ */
+ getChunkDependentHashModulesIterable(chunk) {
+ const cgc = this._getChunkGraphChunk(chunk);
+ return cgc.dependentHashModules;
+ }
/**
* @param {Chunk} chunk the chunk
@@ -1134,7 +1305,7 @@ class ChunkGraph {
/**
* @param {AsyncDependenciesBlock} depBlock the async block
- * @returns {ChunkGroup} the chunk group
+ * @returns {ChunkGroup | undefined} the chunk group
*/
getBlockChunkGroup(depBlock) {
return this._blockChunkGroups.get(depBlock);
@@ -1164,7 +1335,7 @@ class ChunkGraph {
/**
* @param {Module} module the module
- * @returns {string | number} the id of the module
+ * @returns {ModuleId | null} the id of the module
*/
getModuleId(module) {
const cgm = this._getChunkGraphModule(module);
@@ -1173,7 +1344,7 @@ class ChunkGraph {
/**
* @param {Module} module the module
- * @param {string | number} id the id of the module
+ * @param {ModuleId} id the id of the module
* @returns {void}
*/
setModuleId(module, id) {
@@ -1186,7 +1357,7 @@ class ChunkGraph {
* @returns {string | number} the id of the runtime
*/
getRuntimeId(runtime) {
- return this._runtimeIds.get(runtime);
+ return /** @type {string | number} */ (this._runtimeIds.get(runtime));
}
/**
@@ -1223,7 +1394,7 @@ class ChunkGraph {
Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").`
);
}
- return first(hashInfoItems);
+ return /** @type {T} */ (first(hashInfoItems));
} else {
const hashInfo = hashes.get(runtime);
if (!hashInfo) {
@@ -1247,7 +1418,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
*/
hasModuleHashes(module, runtime) {
const cgm = this._getChunkGraphModule(module);
- const hashes = cgm.hashes;
+ const hashes = /** @type {RuntimeSpecMap} */ (cgm.hashes);
return hashes && hashes.has(runtime);
}
@@ -1258,7 +1429,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
*/
getModuleHash(module, runtime) {
const cgm = this._getChunkGraphModule(module);
- const hashes = cgm.hashes;
+ const hashes = /** @type {RuntimeSpecMap} */ (cgm.hashes);
return this._getModuleHashInfo(module, hashes, runtime).hash;
}
@@ -1269,7 +1440,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
*/
getRenderedModuleHash(module, runtime) {
const cgm = this._getChunkGraphModule(module);
- const hashes = cgm.hashes;
+ const hashes = /** @type {RuntimeSpecMap} */ (cgm.hashes);
return this._getModuleHashInfo(module, hashes, runtime).renderedHash;
}
@@ -1291,28 +1462,35 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
/**
* @param {Module} module the module
* @param {RuntimeSpec} runtime the runtime
- * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph)
+ * @param {Set} items runtime requirements to be added (ownership of this Set is given to ChunkGraph when transferOwnership not false)
+ * @param {boolean} transferOwnership true: transfer ownership of the items object, false: items is immutable and shared and won't be modified
* @returns {void}
*/
- addModuleRuntimeRequirements(module, runtime, items) {
+ addModuleRuntimeRequirements(
+ module,
+ runtime,
+ items,
+ transferOwnership = true
+ ) {
const cgm = this._getChunkGraphModule(module);
const runtimeRequirementsMap = cgm.runtimeRequirements;
if (runtimeRequirementsMap === undefined) {
const map = new RuntimeSpecMap();
- map.set(runtime, items);
+ // TODO avoid cloning item and track ownership instead
+ map.set(runtime, transferOwnership ? items : new Set(items));
cgm.runtimeRequirements = map;
return;
}
runtimeRequirementsMap.update(runtime, runtimeRequirements => {
if (runtimeRequirements === undefined) {
- return items;
- } else if (runtimeRequirements.size >= items.size) {
+ return transferOwnership ? items : new Set(items);
+ } else if (!transferOwnership || runtimeRequirements.size >= items.size) {
for (const item of items) runtimeRequirements.add(item);
return runtimeRequirements;
- } else {
- for (const item of runtimeRequirements) items.add(item);
- return items;
}
+
+ for (const item of runtimeRequirements) items.add(item);
+ return items;
});
}
@@ -1367,48 +1545,127 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
return runtimeRequirements === undefined ? EMPTY_SET : runtimeRequirements;
}
+ /**
+ * @param {Module} module the module
+ * @param {RuntimeSpec} runtime the runtime
+ * @param {boolean} withConnections include connections
+ * @returns {string} hash
+ */
getModuleGraphHash(module, runtime, withConnections = true) {
const cgm = this._getChunkGraphModule(module);
+ return withConnections
+ ? this._getModuleGraphHashWithConnections(cgm, module, runtime)
+ : this._getModuleGraphHashBigInt(cgm, module, runtime).toString(16);
+ }
+
+ /**
+ * @param {Module} module the module
+ * @param {RuntimeSpec} runtime the runtime
+ * @param {boolean} withConnections include connections
+ * @returns {bigint} hash
+ */
+ getModuleGraphHashBigInt(module, runtime, withConnections = true) {
+ const cgm = this._getChunkGraphModule(module);
+ return withConnections
+ ? BigInt(
+ `0x${this._getModuleGraphHashWithConnections(cgm, module, runtime)}`
+ )
+ : this._getModuleGraphHashBigInt(cgm, module, runtime);
+ }
+
+ /**
+ * @param {ChunkGraphModule} cgm the ChunkGraphModule
+ * @param {Module} module the module
+ * @param {RuntimeSpec} runtime the runtime
+ * @returns {bigint} hash as big int
+ */
+ _getModuleGraphHashBigInt(cgm, module, runtime) {
if (cgm.graphHashes === undefined) {
cgm.graphHashes = new RuntimeSpecMap();
}
const graphHash = cgm.graphHashes.provide(runtime, () => {
- const hash = createHash("md4");
- hash.update(`${cgm.id}`);
- hash.update(`${this.moduleGraph.isAsync(module)}`);
+ const hash = createHash(this._hashFunction);
+ hash.update(`${cgm.id}${this.moduleGraph.isAsync(module)}`);
+ const sourceTypes = this._getOverwrittenModuleSourceTypes(module);
+ if (sourceTypes !== undefined) {
+ for (const type of sourceTypes) hash.update(type);
+ }
this.moduleGraph.getExportsInfo(module).updateHash(hash, runtime);
- return /** @type {string} */ (hash.digest("hex"));
+ return BigInt(`0x${/** @type {string} */ (hash.digest("hex"))}`);
});
- if (!withConnections) return graphHash;
+ return graphHash;
+ }
+
+ /**
+ * @param {ChunkGraphModule} cgm the ChunkGraphModule
+ * @param {Module} module the module
+ * @param {RuntimeSpec} runtime the runtime
+ * @returns {string} hash
+ */
+ _getModuleGraphHashWithConnections(cgm, module, runtime) {
if (cgm.graphHashesWithConnections === undefined) {
cgm.graphHashesWithConnections = new RuntimeSpecMap();
}
+
+ /**
+ * @param {ConnectionState} state state
+ * @returns {"F" | "T" | "O"} result
+ */
const activeStateToString = state => {
- if (state === false) return "false";
- if (state === true) return "true";
- if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "transitive";
+ if (state === false) return "F";
+ if (state === true) return "T";
+ if (state === ModuleGraphConnection.TRANSITIVE_ONLY) return "O";
throw new Error("Not implemented active state");
};
const strict = module.buildMeta && module.buildMeta.strictHarmonyModule;
return cgm.graphHashesWithConnections.provide(runtime, () => {
+ const graphHash = this._getModuleGraphHashBigInt(
+ cgm,
+ module,
+ runtime
+ ).toString(16);
const connections = this.moduleGraph.getOutgoingConnections(module);
+ /** @type {Set} */
+ const activeNamespaceModules = new Set();
/** @type {Map>} */
const connectedModules = new Map();
- for (const connection of connections) {
- let stateInfo;
- if (typeof runtime === "string") {
+ /**
+ * @param {ModuleGraphConnection} connection connection
+ * @param {string} stateInfo state info
+ */
+ const processConnection = (connection, stateInfo) => {
+ const module = connection.module;
+ stateInfo += module.getExportsType(this.moduleGraph, strict);
+ // cspell:word Tnamespace
+ if (stateInfo === "Tnamespace") activeNamespaceModules.add(module);
+ else {
+ const oldModule = connectedModules.get(stateInfo);
+ if (oldModule === undefined) {
+ connectedModules.set(stateInfo, module);
+ } else if (oldModule instanceof Set) {
+ oldModule.add(module);
+ } else if (oldModule !== module) {
+ connectedModules.set(stateInfo, new Set([oldModule, module]));
+ }
+ }
+ };
+ if (runtime === undefined || typeof runtime === "string") {
+ for (const connection of connections) {
const state = connection.getActiveState(runtime);
if (state === false) continue;
- stateInfo = activeStateToString(state);
- } else {
+ processConnection(connection, state === true ? "T" : "O");
+ }
+ } else {
+ // cspell:word Tnamespace
+ for (const connection of connections) {
const states = new Set();
- stateInfo = "";
+ let stateInfo = "";
forEachRuntime(
runtime,
runtime => {
const state = connection.getActiveState(runtime);
states.add(state);
- stateInfo += runtime + activeStateToString(state);
+ stateInfo += activeStateToString(state) + runtime;
},
true
);
@@ -1417,34 +1674,57 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
if (state === false) continue;
stateInfo = activeStateToString(state);
}
- }
- const module = connection.module;
- stateInfo += module.getExportsType(this.moduleGraph, strict);
- const oldModule = connectedModules.get(stateInfo);
- if (oldModule === undefined) {
- connectedModules.set(stateInfo, module);
- } else if (oldModule instanceof Set) {
- oldModule.add(module);
- } else if (oldModule !== module) {
- connectedModules.set(stateInfo, new Set([oldModule, module]));
+ processConnection(connection, stateInfo);
}
}
- if (connectedModules.size === 0) return graphHash;
+ // cspell:word Tnamespace
+ if (activeNamespaceModules.size === 0 && connectedModules.size === 0)
+ return graphHash;
const connectedModulesInOrder =
connectedModules.size > 1
? Array.from(connectedModules).sort(([a], [b]) => (a < b ? -1 : 1))
: connectedModules;
- const hash = createHash("md4");
+ const hash = createHash(this._hashFunction);
+ /**
+ * @param {Module} module module
+ */
+ const addModuleToHash = module => {
+ hash.update(
+ this._getModuleGraphHashBigInt(
+ this._getChunkGraphModule(module),
+ module,
+ runtime
+ ).toString(16)
+ );
+ };
+ /**
+ * @param {Set} modules modules
+ */
+ const addModulesToHash = modules => {
+ let xor = ZERO_BIG_INT;
+ for (const m of modules) {
+ xor =
+ xor ^
+ this._getModuleGraphHashBigInt(
+ this._getChunkGraphModule(m),
+ m,
+ runtime
+ );
+ }
+ hash.update(xor.toString(16));
+ };
+ if (activeNamespaceModules.size === 1)
+ addModuleToHash(
+ /** @type {Module} */ (activeNamespaceModules.values().next().value)
+ );
+ else if (activeNamespaceModules.size > 1)
+ addModulesToHash(activeNamespaceModules);
for (const [stateInfo, modules] of connectedModulesInOrder) {
hash.update(stateInfo);
if (modules instanceof Set) {
- const xor = new StringXor();
- for (const m of modules) {
- xor.add(this.getModuleGraphHash(m, runtime, false));
- }
- xor.updateHash(hash);
+ addModulesToHash(modules);
} else {
- hash.update(this.getModuleGraphHash(modules, runtime, false));
+ addModuleToHash(modules);
}
}
hash.update(graphHash);
@@ -1480,12 +1760,13 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
const chunkGraph = chunkGraphForModuleMap.get(module);
if (!chunkGraph)
throw new Error(
- deprecateMessage +
- ": There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)"
+ `${
+ deprecateMessage
+ }: There was no ChunkGraph assigned to the Module for backward-compat (Use the new API)`
);
return chunkGraph;
},
- deprecateMessage + ": Use new ChunkGraph API",
+ `${deprecateMessage}: Use new ChunkGraph API`,
deprecationCode
);
deprecateGetChunkGraphForModuleMap.set(deprecateMessage, newFn);
@@ -1530,12 +1811,13 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
const chunkGraph = chunkGraphForChunkMap.get(chunk);
if (!chunkGraph)
throw new Error(
- deprecateMessage +
- "There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)"
+ `${
+ deprecateMessage
+ }There was no ChunkGraph assigned to the Chunk for backward-compat (Use the new API)`
);
return chunkGraph;
},
- deprecateMessage + ": Use new ChunkGraph API",
+ `${deprecateMessage}: Use new ChunkGraph API`,
deprecationCode
);
deprecateGetChunkGraphForChunkMap.set(deprecateMessage, newFn);
diff --git a/lib/ChunkGroup.js b/lib/ChunkGroup.js
index 69b2128a316..9b899dd214f 100644
--- a/lib/ChunkGroup.js
+++ b/lib/ChunkGroup.js
@@ -22,12 +22,13 @@ const {
/** @typedef {import("./ModuleGraph")} ModuleGraph */
/** @typedef {{id: number}} HasId */
-/** @typedef {{module: Module, loc: DependencyLocation, request: string}} OriginRecord */
+/** @typedef {{module: Module | null, loc: DependencyLocation, request: string}} OriginRecord */
/**
- * @typedef {Object} RawChunkGroupOptions
+ * @typedef {object} RawChunkGroupOptions
* @property {number=} preloadOrder
* @property {number=} prefetchOrder
+ * @property {("low" | "high" | "auto")=} fetchPriority
*/
/** @typedef {RawChunkGroupOptions & { name?: string }} ChunkGroupOptions */
@@ -69,7 +70,7 @@ const sortOrigin = (a, b) => {
class ChunkGroup {
/**
* Creates an instance of ChunkGroup.
- * @param {string|ChunkGroupOptions=} options chunk group options passed to chunkGroup
+ * @param {string | ChunkGroupOptions=} options chunk group options passed to chunkGroup
*/
constructor(options) {
if (typeof options === "string") {
@@ -79,7 +80,7 @@ class ChunkGroup {
}
/** @type {number} */
this.groupDebugId = debugId++;
- this.options = options;
+ this.options = /** @type {ChunkGroupOptions} */ (options);
/** @type {SortableSet} */
this._children = new SortableSet(undefined, sortById);
/** @type {SortableSet} */
@@ -92,12 +93,18 @@ class ChunkGroup {
/** @type {OriginRecord[]} */
this.origins = [];
/** Indices in top-down order */
- /** @private @type {Map} */
+ /**
+ * @private
+ * @type {Map}
+ */
this._modulePreOrderIndices = new Map();
/** Indices in bottom-up order */
- /** @private @type {Map} */
+ /**
+ * @private
+ * @type {Map}
+ */
this._modulePostOrderIndices = new Map();
- /** @type {number} */
+ /** @type {number | undefined} */
this.index = undefined;
}
@@ -107,12 +114,18 @@ class ChunkGroup {
* @returns {void}
*/
addOptions(options) {
- for (const key of Object.keys(options)) {
+ for (const _key of Object.keys(options)) {
+ const key = /** @type {keyof ChunkGroupOptions} */ (_key);
if (this.options[key] === undefined) {
- this.options[key] = options[key];
+ /** @type {TODO} */
+ (this.options)[key] = options[key];
} else if (this.options[key] !== options[key]) {
if (key.endsWith("Order")) {
- this.options[key] = Math.max(this.options[key], options[key]);
+ /** @type {TODO} */
+ (this.options)[key] = Math.max(
+ /** @type {number} */ (this.options[key]),
+ /** @type {number} */ (options[key])
+ );
} else {
throw new Error(
`ChunkGroup.addOptions: No option merge strategy for ${key}`
@@ -124,7 +137,7 @@ class ChunkGroup {
/**
* returns the name of current ChunkGroup
- * @returns {string|undefined} returns the ChunkGroup name
+ * @returns {string | undefined} returns the ChunkGroup name
*/
get name() {
return this.options.name;
@@ -132,7 +145,7 @@ class ChunkGroup {
/**
* sets a new name for current ChunkGroup
- * @param {string} value the new name for ChunkGroup
+ * @param {string | undefined} value the new name for ChunkGroup
* @returns {void}
*/
set name(value) {
@@ -212,7 +225,7 @@ class ChunkGroup {
/**
* @param {Chunk} oldChunk chunk to be replaced
* @param {Chunk} newChunk New chunk that will be replaced with
- * @returns {boolean} returns true if the replacement was successful
+ * @returns {boolean | undefined} returns true if the replacement was successful
*/
replaceChunk(oldChunk, newChunk) {
const oldIdx = this.chunks.indexOf(oldChunk);
@@ -353,7 +366,7 @@ class ChunkGroup {
}
/**
- * @returns {Array} an array containing the blocks
+ * @returns {Array} an array containing the blocks
*/
getBlocks() {
return this._blocks.getFromCache(getArray);
@@ -363,6 +376,10 @@ class ChunkGroup {
return this._blocks.size;
}
+ /**
+ * @param {AsyncDependenciesBlock} block block
+ * @returns {boolean} true, if block exists
+ */
hasBlock(block) {
return this._blocks.has(block);
}
@@ -387,7 +404,7 @@ class ChunkGroup {
}
/**
- * @param {Module} module origin module
+ * @param {Module | null} module origin module
* @param {DependencyLocation} loc location of the reference in the origin module
* @param {string} request request name of the reference
* @returns {void}
@@ -461,7 +478,6 @@ class ChunkGroup {
/**
* Sorting predicate which allows current ChunkGroup to be compared against another.
* Sorting values are based off of number of chunks in ChunkGroup.
- *
* @param {ChunkGraph} chunkGraph the chunk graph
* @param {ChunkGroup} otherGroup the chunkGroup to compare this against
* @returns {-1|0|1} sort position for comparison
@@ -486,13 +502,17 @@ class ChunkGroup {
for (const childGroup of this._children) {
for (const key of Object.keys(childGroup.options)) {
if (key.endsWith("Order")) {
- const name = key.substr(0, key.length - "Order".length);
+ const name = key.slice(0, key.length - "Order".length);
let list = lists.get(name);
if (list === undefined) {
lists.set(name, (list = []));
}
list.push({
- order: childGroup.options[key],
+ order:
+ /** @type {number} */
+ (
+ childGroup.options[/** @type {keyof ChunkGroupOptions} */ (key)]
+ ),
group: childGroup
});
}
@@ -524,7 +544,7 @@ class ChunkGroup {
/**
* Gets the top-down index of a module in this ChunkGroup
* @param {Module} module the module
- * @returns {number} index
+ * @returns {number | undefined} index
*/
getModulePreOrderIndex(module) {
return this._modulePreOrderIndices.get(module);
@@ -543,7 +563,7 @@ class ChunkGroup {
/**
* Gets the bottom-up index of a module in this ChunkGroup
* @param {Module} module the module
- * @returns {number} index
+ * @returns {number | undefined} index
*/
getModulePostOrderIndex(module) {
return this._modulePostOrderIndices.get(module);
diff --git a/lib/ChunkRenderError.js b/lib/ChunkRenderError.js
index d7e03714fc5..fce913f171a 100644
--- a/lib/ChunkRenderError.js
+++ b/lib/ChunkRenderError.js
@@ -25,8 +25,6 @@ class ChunkRenderError extends WebpackError {
this.details = error.stack;
this.file = file;
this.chunk = chunk;
-
- Error.captureStackTrace(this, this.constructor);
}
}
diff --git a/lib/ChunkTemplate.js b/lib/ChunkTemplate.js
index e98280f594b..238144a30ac 100644
--- a/lib/ChunkTemplate.js
+++ b/lib/ChunkTemplate.js
@@ -8,8 +8,21 @@
const util = require("util");
const memoize = require("./util/memoize");
+/** @typedef {import("tapable").Tap} Tap */
/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */
+/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compilation")} Compilation */
+/** @typedef {import("./Compilation").ChunkHashContext} ChunkHashContext */
+/** @typedef {import("./Compilation").Hash} Hash */
+/** @typedef {import("./Compilation").RenderManifestEntry} RenderManifestEntry */
+/** @typedef {import("./Compilation").RenderManifestOptions} RenderManifestOptions */
+/** @typedef {import("./Compilation").Source} Source */
+/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
+/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext */
+/**
+ * @template T
+ * @typedef {import("tapable").IfSet} IfSet
+ */
const getJavascriptModulesPlugin = memoize(() =>
require("./javascript/JavascriptModulesPlugin")
@@ -26,6 +39,11 @@ class ChunkTemplate {
this.hooks = Object.freeze({
renderManifest: {
tap: util.deprecate(
+ /**
+ * @template AdditionalOptions
+ * @param {string | Tap & IfSet} options options
+ * @param {function(RenderManifestEntry[], RenderManifestOptions): RenderManifestEntry[]} fn function
+ */
(options, fn) => {
compilation.hooks.renderManifest.tap(
options,
@@ -41,6 +59,11 @@ class ChunkTemplate {
},
modules: {
tap: util.deprecate(
+ /**
+ * @template AdditionalOptions
+ * @param {string | Tap & IfSet} options options
+ * @param {function(Source, ModuleTemplate, RenderContext): Source} fn function
+ */
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
@@ -58,6 +81,11 @@ class ChunkTemplate {
},
render: {
tap: util.deprecate(
+ /**
+ * @template AdditionalOptions
+ * @param {string | Tap & IfSet} options options
+ * @param {function(Source, ModuleTemplate, RenderContext): Source} fn function
+ */
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
@@ -75,6 +103,11 @@ class ChunkTemplate {
},
renderWithEntry: {
tap: util.deprecate(
+ /**
+ * @template AdditionalOptions
+ * @param {string | Tap & IfSet} options options
+ * @param {function(Source, Chunk): Source} fn function
+ */
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
@@ -96,6 +129,11 @@ class ChunkTemplate {
},
hash: {
tap: util.deprecate(
+ /**
+ * @template AdditionalOptions
+ * @param {string | Tap & IfSet} options options
+ * @param {function(Hash): void} fn function
+ */
(options, fn) => {
compilation.hooks.fullHash.tap(options, fn);
},
@@ -105,6 +143,11 @@ class ChunkTemplate {
},
hashForChunk: {
tap: util.deprecate(
+ /**
+ * @template AdditionalOptions
+ * @param {string | Tap & IfSet} options options
+ * @param {function(Hash, Chunk, ChunkHashContext): void} fn function
+ */
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
diff --git a/lib/CleanPlugin.js b/lib/CleanPlugin.js
index f796e317afc..5c15b328218 100644
--- a/lib/CleanPlugin.js
+++ b/lib/CleanPlugin.js
@@ -6,45 +6,74 @@
"use strict";
const asyncLib = require("neo-async");
-const { validate } = require("schema-utils");
const { SyncBailHook } = require("tapable");
-const Compilation = require("../lib/Compilation");
+const Compilation = require("./Compilation");
+const createSchemaValidation = require("./util/create-schema-validation");
const { join } = require("./util/fs");
-const memoize = require("./util/memoize");
const processAsyncTree = require("./util/processAsyncTree");
/** @typedef {import("../declarations/WebpackOptions").CleanOptions} CleanOptions */
/** @typedef {import("./Compiler")} Compiler */
/** @typedef {import("./logging/Logger").Logger} Logger */
+/** @typedef {import("./util/fs").IStats} IStats */
/** @typedef {import("./util/fs").OutputFileSystem} OutputFileSystem */
+/** @typedef {import("./util/fs").StatsCallback} StatsCallback */
/** @typedef {(function(string):boolean)|RegExp} IgnoreItem */
+/** @typedef {Map} Assets */
/** @typedef {function(IgnoreItem): void} AddToIgnoreCallback */
/**
- * @typedef {Object} CleanPluginCompilationHooks
+ * @typedef {object} CleanPluginCompilationHooks
* @property {SyncBailHook<[string], boolean>} keep when returning true the file/directory will be kept during cleaning, returning false will clean it and ignore the following plugins and config
*/
-const getSchema = memoize(() => {
- const { definitions } = require("../schemas/WebpackOptions.json");
- return {
- definitions,
- oneOf: [{ $ref: "#/definitions/CleanOptions" }]
- };
-});
+/**
+ * @callback KeepFn
+ * @param {string} path path
+ * @returns {boolean} true, if the path should be kept
+ */
+
+const validate = createSchemaValidation(
+ undefined,
+ () => {
+ const { definitions } = require("../schemas/WebpackOptions.json");
+ return {
+ definitions,
+ oneOf: [{ $ref: "#/definitions/CleanOptions" }]
+ };
+ },
+ {
+ name: "Clean Plugin",
+ baseDataPath: "options"
+ }
+);
+const _10sec = 10 * 1000;
+
+/**
+ * marge assets map 2 into map 1
+ * @param {Assets} as1 assets
+ * @param {Assets} as2 assets
+ * @returns {void}
+ */
+const mergeAssets = (as1, as2) => {
+ for (const [key, value1] of as2) {
+ const value2 = as1.get(key);
+ if (!value2 || value1 > value2) as1.set(key, value1);
+ }
+};
/**
* @param {OutputFileSystem} fs filesystem
* @param {string} outputPath output path
- * @param {Set} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator)
- * @param {function(Error=, Set=): void} callback returns the filenames of the assets that shouldn't be there
+ * @param {Map} currentAssets filename of the current assets (must not start with .. or ., must only use / as path separator)
+ * @param {function((Error | null)=, Set=): void} callback returns the filenames of the assets that shouldn't be there
* @returns {void}
*/
const getDiffToFs = (fs, outputPath, currentAssets, callback) => {
const directories = new Set();
// get directories of assets
- for (const asset of currentAssets) {
+ for (const [asset] of currentAssets) {
directories.add(asset.replace(/(^|\/)[^/]*$/, ""));
}
// and all parent directories
@@ -56,7 +85,8 @@ const getDiffToFs = (fs, outputPath, currentAssets, callback) => {
directories,
10,
(directory, callback) => {
- fs.readdir(join(fs, outputPath, directory), (err, entries) => {
+ /** @type {NonNullable} */
+ (fs.readdir)(join(fs, outputPath, directory), (err, entries) => {
if (err) {
if (err.code === "ENOENT") return callback();
if (err.code === "ENOTDIR") {
@@ -65,8 +95,8 @@ const getDiffToFs = (fs, outputPath, currentAssets, callback) => {
}
return callback(err);
}
- for (const entry of entries) {
- const file = /** @type {string} */ (entry);
+ for (const entry of /** @type {string[]} */ (entries)) {
+ const file = entry;
const filename = directory ? `${directory}/${file}` : file;
if (!directories.has(filename) && !currentAssets.has(filename)) {
diff.add(filename);
@@ -84,18 +114,35 @@ const getDiffToFs = (fs, outputPath, currentAssets, callback) => {
};
/**
- * @param {Set} currentAssets assets list
- * @param {Set} oldAssets old assets list
+ * @param {Assets} currentAssets assets list
+ * @param {Assets} oldAssets old assets list
* @returns {Set} diff
*/
const getDiffToOldAssets = (currentAssets, oldAssets) => {
const diff = new Set();
- for (const asset of oldAssets) {
+ const now = Date.now();
+ for (const [asset, ts] of oldAssets) {
+ if (ts >= now) continue;
if (!currentAssets.has(asset)) diff.add(asset);
}
return diff;
};
+/**
+ * @param {OutputFileSystem} fs filesystem
+ * @param {string} filename path to file
+ * @param {StatsCallback} callback callback for provided filename
+ * @returns {void}
+ */
+const doStat = (fs, filename, callback) => {
+ if ("lstat" in fs) {
+ /** @type {NonNullable} */
+ (fs.lstat)(filename, callback);
+ } else {
+ fs.stat(filename, callback);
+ }
+};
+
/**
* @param {OutputFileSystem} fs filesystem
* @param {string} outputPath output path
@@ -103,10 +150,13 @@ const getDiffToOldAssets = (currentAssets, oldAssets) => {
* @param {Logger} logger logger
* @param {Set} diff filenames of the assets that shouldn't be there
* @param {function(string): boolean} isKept check if the entry is ignored
- * @param {function(Error=): void} callback callback
+ * @param {function(Error=, Assets=): void} callback callback
* @returns {void}
*/
const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
+ /**
+ * @param {string} msg message
+ */
const log = msg => {
if (dry) {
logger.info(msg);
@@ -116,15 +166,21 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
};
/** @typedef {{ type: "check" | "unlink" | "rmdir", filename: string, parent: { remaining: number, job: Job } | undefined }} Job */
/** @type {Job[]} */
- const jobs = Array.from(diff, filename => ({
+ const jobs = Array.from(diff.keys(), filename => ({
type: "check",
filename,
parent: undefined
}));
+ /** @type {Assets} */
+ const keptAssets = new Map();
processAsyncTree(
jobs,
10,
({ type, filename, parent }, push, callback) => {
+ /**
+ * @param {Error & { code?: string }} err error
+ * @returns {void}
+ */
const handleError = err => {
if (err.code === "ENOENT") {
log(`${filename} was removed during cleaning by something else`);
@@ -140,13 +196,14 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
switch (type) {
case "check":
if (isKept(filename)) {
+ keptAssets.set(filename, 0);
// do not decrement parent entry as we don't want to delete the parent
log(`${filename} will be kept`);
return process.nextTick(callback);
}
- fs.stat(path, (err, stats) => {
+ doStat(fs, path, (err, stats) => {
if (err) return handleError(err);
- if (!stats.isDirectory()) {
+ if (!(/** @type {IStats} */ (stats).isDirectory())) {
push({
type: "unlink",
filename,
@@ -154,7 +211,9 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
});
return callback();
}
- fs.readdir(path, (err, entries) => {
+
+ /** @type {NonNullable} */
+ (fs.readdir)(path, (err, _entries) => {
if (err) return handleError(err);
/** @type {Job} */
const deleteJob = {
@@ -162,6 +221,7 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
filename,
parent
};
+ const entries = /** @type {string[]} */ (_entries);
if (entries.length === 0) {
push(deleteJob);
} else {
@@ -226,7 +286,10 @@ const applyDiff = (fs, outputPath, dry, logger, diff, isKept, callback) => {
break;
}
},
- callback
+ err => {
+ if (err) return callback(err);
+ callback(undefined, keptAssets);
+ }
);
};
@@ -255,13 +318,9 @@ class CleanPlugin {
return hooks;
}
- /** @param {CleanOptions} [options] options */
+ /** @param {CleanOptions} options options */
constructor(options = {}) {
- validate(getSchema(), options, {
- name: "Clean Plugin",
- baseDataPath: "options"
- });
-
+ validate(options);
this.options = { dry: false, ...options };
}
@@ -273,18 +332,20 @@ class CleanPlugin {
apply(compiler) {
const { dry, keep } = this.options;
+ /** @type {KeepFn} */
const keepFn =
typeof keep === "function"
? keep
: typeof keep === "string"
- ? path => path.startsWith(keep)
- : typeof keep === "object" && keep.test
- ? path => keep.test(path)
- : () => false;
+ ? path => path.startsWith(keep)
+ : typeof keep === "object" && keep.test
+ ? path => keep.test(path)
+ : () => false;
// We assume that no external modification happens while the compiler is active
// So we can store the old assets and only diff to them to avoid fs access on
// incremental builds
+ /** @type {undefined|Assets} */
let oldAssets;
compiler.hooks.emit.tapAsync(
@@ -295,7 +356,7 @@ class CleanPlugin {
(compilation, callback) => {
const hooks = CleanPlugin.getCompilationHooks(compilation);
const logger = compilation.getLogger("webpack.CleanPlugin");
- const fs = compiler.outputFileSystem;
+ const fs = /** @type {OutputFileSystem} */ (compiler.outputFileSystem);
if (!fs.readdir) {
return callback(
@@ -305,7 +366,9 @@ class CleanPlugin {
);
}
- const currentAssets = new Set();
+ /** @type {Assets} */
+ const currentAssets = new Map();
+ const now = Date.now();
for (const asset of Object.keys(compilation.assets)) {
if (/^[A-Za-z]:\\|^\/|^\\\\/.test(asset)) continue;
let normalizedAsset;
@@ -318,30 +381,54 @@ class CleanPlugin {
);
} while (newNormalizedAsset !== normalizedAsset);
if (normalizedAsset.startsWith("../")) continue;
- currentAssets.add(normalizedAsset);
+ const assetInfo = compilation.assetsInfo.get(asset);
+ if (assetInfo && assetInfo.hotModuleReplacement) {
+ currentAssets.set(normalizedAsset, now + _10sec);
+ } else {
+ currentAssets.set(normalizedAsset, 0);
+ }
}
const outputPath = compilation.getPath(compiler.outputPath, {});
+ /**
+ * @param {string} path path
+ * @returns {boolean} true, if needs to be kept
+ */
const isKept = path => {
const result = hooks.keep.call(path);
if (result !== undefined) return result;
return keepFn(path);
};
+ /**
+ * @param {(Error | null)=} err err
+ * @param {Set=} diff diff
+ */
const diffCallback = (err, diff) => {
if (err) {
oldAssets = undefined;
- return callback(err);
+ callback(err);
+ return;
}
- applyDiff(fs, outputPath, dry, logger, diff, isKept, err => {
- if (err) {
- oldAssets = undefined;
- } else {
- oldAssets = currentAssets;
+ applyDiff(
+ fs,
+ outputPath,
+ dry,
+ logger,
+ /** @type {Set} */ (diff),
+ isKept,
+ (err, keptAssets) => {
+ if (err) {
+ oldAssets = undefined;
+ } else {
+ if (oldAssets) mergeAssets(currentAssets, oldAssets);
+ oldAssets = currentAssets;
+ if (keptAssets) mergeAssets(oldAssets, keptAssets);
+ }
+ callback(err);
}
- callback(err);
- });
+ );
};
if (oldAssets) {
diff --git a/lib/CodeGenerationError.js b/lib/CodeGenerationError.js
index 144afe0eed1..b1cf51d744e 100644
--- a/lib/CodeGenerationError.js
+++ b/lib/CodeGenerationError.js
@@ -23,8 +23,6 @@ class CodeGenerationError extends WebpackError {
this.message = error.message;
this.details = error.stack;
this.module = module;
-
- Error.captureStackTrace(this, this.constructor);
}
}
diff --git a/lib/CodeGenerationResults.js b/lib/CodeGenerationResults.js
index 2de8455a847..f0759985e76 100644
--- a/lib/CodeGenerationResults.js
+++ b/lib/CodeGenerationResults.js
@@ -5,7 +5,7 @@
"use strict";
-const { provide } = require("./util/MapHelpers");
+const { getOrInsert } = require("./util/MapHelpers");
const { first } = require("./util/SetHelpers");
const createHash = require("./util/createHash");
const { runtimeToString, RuntimeSpecMap } = require("./util/runtime");
@@ -13,12 +13,17 @@ const { runtimeToString, RuntimeSpecMap } = require("./util/runtime");
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("./Module")} Module */
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
+/** @typedef {typeof import("./util/Hash")} Hash */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
class CodeGenerationResults {
- constructor() {
+ /**
+ * @param {string | Hash} hashFunction the hash function to use
+ */
+ constructor(hashFunction = "md4") {
/** @type {Map>} */
this.map = new Map();
+ this._hashFunction = hashFunction;
}
/**
@@ -37,7 +42,9 @@ class CodeGenerationResults {
);
}
if (runtime === undefined) {
- if (entry.size > 1) {
+ if (
+ /** @type {RuntimeSpecMap} */ (entry).size > 1
+ ) {
const results = new Set(entry.values());
if (results.size !== 1) {
throw new Error(
@@ -48,9 +55,9 @@ class CodeGenerationResults {
Caller might not support runtime-dependent code generation (opt-out via optimization.usedExports: "global").`
);
}
- return first(results);
+ return /** @type {CodeGenerationResult} */ (first(results));
}
- return entry.values().next().value;
+ return /** @type {CodeGenerationResult} */ (entry.values().next().value);
}
const result = entry.get(runtime);
if (result === undefined) {
@@ -81,9 +88,8 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
} else if (entry.size > 1) {
const results = new Set(entry.values());
return results.size === 1;
- } else {
- return entry.size === 1;
}
+ return entry.size === 1;
}
/**
@@ -124,7 +130,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
getHash(module, runtime) {
const info = this.get(module, runtime);
if (info.hash !== undefined) return info.hash;
- const hash = createHash("md4");
+ const hash = createHash(this._hashFunction);
for (const [type, source] of info.sources) {
hash.update(type);
source.updateHash(hash);
@@ -142,7 +148,7 @@ Caller might not support runtime-dependent code generation (opt-out via optimiza
* @returns {void}
*/
add(module, runtime, result) {
- const map = provide(this.map, module, () => new RuntimeSpecMap());
+ const map = getOrInsert(this.map, module, () => new RuntimeSpecMap());
map.set(runtime, result);
}
}
diff --git a/lib/CommentCompilationWarning.js b/lib/CommentCompilationWarning.js
index 7aa47c763b8..99cd0fbdada 100644
--- a/lib/CommentCompilationWarning.js
+++ b/lib/CommentCompilationWarning.js
@@ -12,7 +12,6 @@ const makeSerializable = require("./util/makeSerializable");
class CommentCompilationWarning extends WebpackError {
/**
- *
* @param {string} message warning message
* @param {DependencyLocation} loc affected lines of code
*/
@@ -22,8 +21,6 @@ class CommentCompilationWarning extends WebpackError {
this.name = "CommentCompilationWarning";
this.loc = loc;
-
- Error.captureStackTrace(this, this.constructor);
}
}
diff --git a/lib/CompatibilityPlugin.js b/lib/CompatibilityPlugin.js
index b86a64ea54c..46ddd7e802e 100644
--- a/lib/CompatibilityPlugin.js
+++ b/lib/CompatibilityPlugin.js
@@ -5,12 +5,22 @@
"use strict";
+const {
+ JAVASCRIPT_MODULE_TYPE_AUTO,
+ JAVASCRIPT_MODULE_TYPE_DYNAMIC,
+ JAVASCRIPT_MODULE_TYPE_ESM
+} = require("./ModuleTypeConstants");
+const RuntimeGlobals = require("./RuntimeGlobals");
const ConstDependency = require("./dependencies/ConstDependency");
+/** @typedef {import("estree").CallExpression} CallExpression */
/** @typedef {import("./Compiler")} Compiler */
+/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./javascript/JavascriptParser")} JavascriptParser */
+/** @typedef {import("./javascript/JavascriptParser").Range} Range */
-const nestedWebpackRequireTag = Symbol("nested __webpack_require__");
+const nestedWebpackIdentifierTag = Symbol("nested webpack identifier");
+const PLUGIN_NAME = "CompatibilityPlugin";
class CompatibilityPlugin {
/**
@@ -20,7 +30,7 @@ class CompatibilityPlugin {
*/
apply(compiler) {
compiler.hooks.compilation.tap(
- "CompatibilityPlugin",
+ PLUGIN_NAME,
(compilation, { normalModuleFactory }) => {
compilation.dependencyTemplates.set(
ConstDependency,
@@ -28,24 +38,31 @@ class CompatibilityPlugin {
);
normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("CompatibilityPlugin", (parser, parserOptions) => {
+ .for(JAVASCRIPT_MODULE_TYPE_AUTO)
+ .tap(PLUGIN_NAME, (parser, parserOptions) => {
if (
parserOptions.browserify !== undefined &&
!parserOptions.browserify
)
return;
- parser.hooks.call
- .for("require")
- .tap("CompatibilityPlugin", expr => {
+ parser.hooks.call.for("require").tap(
+ PLUGIN_NAME,
+ /**
+ * @param {CallExpression} expr call expression
+ * @returns {boolean | void} true when need to handle
+ */
+ expr => {
// support for browserify style require delegator: "require(o, !0)"
if (expr.arguments.length !== 2) return;
const second = parser.evaluateExpression(expr.arguments[1]);
if (!second.isBoolean()) return;
if (second.asBool() !== true) return;
- const dep = new ConstDependency("require", expr.callee.range);
- dep.loc = expr.loc;
+ const dep = new ConstDependency(
+ "require",
+ /** @type {Range} */ (expr.callee.range)
+ );
+ dep.loc = /** @type {DependencyLocation} */ (expr.loc);
if (parser.state.current.dependencies.length > 0) {
const last =
parser.state.current.dependencies[
@@ -62,38 +79,61 @@ class CompatibilityPlugin {
}
parser.state.module.addPresentationalDependency(dep);
return true;
- });
+ }
+ );
});
/**
* @param {JavascriptParser} parser the parser
* @returns {void}
*/
- const nestedWebpackRequireHandler = parser => {
- parser.hooks.preStatement.tap("CompatibilityPlugin", statement => {
+ const handler = parser => {
+ // Handle nested requires
+ parser.hooks.preStatement.tap(PLUGIN_NAME, statement => {
if (
statement.type === "FunctionDeclaration" &&
statement.id &&
- statement.id.name === "__webpack_require__"
+ statement.id.name === RuntimeGlobals.require
) {
- const newName = `__nested_webpack_require_${statement.range[0]}__`;
- parser.tagVariable(statement.id.name, nestedWebpackRequireTag, {
+ const newName = `__nested_webpack_require_${
+ /** @type {Range} */ (statement.range)[0]
+ }__`;
+ parser.tagVariable(
+ statement.id.name,
+ nestedWebpackIdentifierTag,
+ {
+ name: newName,
+ declaration: {
+ updated: false,
+ loc: statement.id.loc,
+ range: statement.id.range
+ }
+ }
+ );
+ return true;
+ }
+ });
+ parser.hooks.pattern
+ .for(RuntimeGlobals.require)
+ .tap(PLUGIN_NAME, pattern => {
+ const newName = `__nested_webpack_require_${
+ /** @type {Range} */ (pattern.range)[0]
+ }__`;
+ parser.tagVariable(pattern.name, nestedWebpackIdentifierTag, {
name: newName,
declaration: {
updated: false,
- loc: statement.id.loc,
- range: statement.id.range
+ loc: pattern.loc,
+ range: pattern.range
}
});
return true;
- }
- });
+ });
parser.hooks.pattern
- .for("__webpack_require__")
- .tap("CompatibilityPlugin", pattern => {
- const newName = `__nested_webpack_require_${pattern.range[0]}__`;
- parser.tagVariable(pattern.name, nestedWebpackRequireTag, {
- name: newName,
+ .for(RuntimeGlobals.exports)
+ .tap(PLUGIN_NAME, pattern => {
+ parser.tagVariable(pattern.name, nestedWebpackIdentifierTag, {
+ name: "__nested_webpack_exports__",
declaration: {
updated: false,
loc: pattern.loc,
@@ -103,8 +143,8 @@ class CompatibilityPlugin {
return true;
});
parser.hooks.expression
- .for(nestedWebpackRequireTag)
- .tap("CompatibilityPlugin", expr => {
+ .for(nestedWebpackIdentifierTag)
+ .tap(PLUGIN_NAME, expr => {
const { name, declaration } = parser.currentTagData;
if (!declaration.updated) {
const dep = new ConstDependency(name, declaration.range);
@@ -112,22 +152,38 @@ class CompatibilityPlugin {
parser.state.module.addPresentationalDependency(dep);
declaration.updated = true;
}
- const dep = new ConstDependency(name, expr.range);
- dep.loc = expr.loc;
+ const dep = new ConstDependency(
+ name,
+ /** @type {Range} */ (expr.range)
+ );
+ dep.loc = /** @type {DependencyLocation} */ (expr.loc);
parser.state.module.addPresentationalDependency(dep);
return true;
});
+
+ // Handle hashbang
+ parser.hooks.program.tap(PLUGIN_NAME, (program, comments) => {
+ if (comments.length === 0) return;
+ const c = comments[0];
+ if (c.type === "Line" && /** @type {Range} */ (c.range)[0] === 0) {
+ if (parser.state.source.slice(0, 2).toString() !== "#!") return;
+ // this is a hashbang comment
+ const dep = new ConstDependency("//", 0);
+ dep.loc = /** @type {DependencyLocation} */ (c.loc);
+ parser.state.module.addPresentationalDependency(dep);
+ }
+ });
};
normalModuleFactory.hooks.parser
- .for("javascript/auto")
- .tap("CompatibilityPlugin", nestedWebpackRequireHandler);
+ .for(JAVASCRIPT_MODULE_TYPE_AUTO)
+ .tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
- .for("javascript/dynamic")
- .tap("CompatibilityPlugin", nestedWebpackRequireHandler);
+ .for(JAVASCRIPT_MODULE_TYPE_DYNAMIC)
+ .tap(PLUGIN_NAME, handler);
normalModuleFactory.hooks.parser
- .for("javascript/esm")
- .tap("CompatibilityPlugin", nestedWebpackRequireHandler);
+ .for(JAVASCRIPT_MODULE_TYPE_ESM)
+ .tap(PLUGIN_NAME, handler);
}
);
}
diff --git a/lib/Compilation.js b/lib/Compilation.js
index 5a458df260a..124974b0366 100644
--- a/lib/Compilation.js
+++ b/lib/Compilation.js
@@ -12,7 +12,8 @@ const {
SyncBailHook,
SyncWaterfallHook,
AsyncSeriesHook,
- AsyncSeriesBailHook
+ AsyncSeriesBailHook,
+ AsyncParallelHook
} = require("tapable");
const util = require("util");
const { CachedSource } = require("webpack-sources");
@@ -24,6 +25,7 @@ const ChunkRenderError = require("./ChunkRenderError");
const ChunkTemplate = require("./ChunkTemplate");
const CodeGenerationError = require("./CodeGenerationError");
const CodeGenerationResults = require("./CodeGenerationResults");
+const Dependency = require("./Dependency");
const DependencyTemplates = require("./DependencyTemplates");
const Entrypoint = require("./Entrypoint");
const ErrorHelpers = require("./ErrorHelpers");
@@ -32,17 +34,22 @@ const {
connectChunkGroupAndChunk,
connectChunkGroupParentAndChild
} = require("./GraphHelpers");
-const { makeWebpackError } = require("./HookWebpackError");
+const {
+ makeWebpackError,
+ tryRunOrWebpackError
+} = require("./HookWebpackError");
const MainTemplate = require("./MainTemplate");
const Module = require("./Module");
const ModuleDependencyError = require("./ModuleDependencyError");
const ModuleDependencyWarning = require("./ModuleDependencyWarning");
const ModuleGraph = require("./ModuleGraph");
+const ModuleHashingError = require("./ModuleHashingError");
const ModuleNotFoundError = require("./ModuleNotFoundError");
const ModuleProfile = require("./ModuleProfile");
const ModuleRestoreError = require("./ModuleRestoreError");
const ModuleStoreError = require("./ModuleStoreError");
const ModuleTemplate = require("./ModuleTemplate");
+const { WEBPACK_MODULE_TYPE_RUNTIME } = require("./ModuleTypeConstants");
const RuntimeGlobals = require("./RuntimeGlobals");
const RuntimeTemplate = require("./RuntimeTemplate");
const Stats = require("./Stats");
@@ -55,7 +62,8 @@ const StatsPrinter = require("./stats/StatsPrinter");
const { equals: arrayEquals } = require("./util/ArrayHelpers");
const AsyncQueue = require("./util/AsyncQueue");
const LazySet = require("./util/LazySet");
-const { provide } = require("./util/MapHelpers");
+const { getOrInsert } = require("./util/MapHelpers");
+const WeakTupleMap = require("./util/WeakTupleMap");
const { cachedCleverMerge } = require("./util/cleverMerge");
const {
compareLocations,
@@ -71,6 +79,7 @@ const {
soonFrozenObjectDeprecation,
createFakeHook
} = require("./util/deprecation");
+const processAsyncTree = require("./util/processAsyncTree");
const { getRuntimeKey } = require("./util/runtime");
const { isSourceEqual } = require("./util/source");
@@ -79,22 +88,28 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {import("../declarations/WebpackOptions").EntryDescriptionNormalized} EntryDescription */
/** @typedef {import("../declarations/WebpackOptions").OutputNormalized} OutputOptions */
/** @typedef {import("../declarations/WebpackOptions").StatsOptions} StatsOptions */
+/** @typedef {import("../declarations/WebpackOptions").WebpackOptionsNormalized} WebpackOptions */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginFunction} WebpackPluginFunction */
/** @typedef {import("../declarations/WebpackOptions").WebpackPluginInstance} WebpackPluginInstance */
/** @typedef {import("./AsyncDependenciesBlock")} AsyncDependenciesBlock */
/** @typedef {import("./Cache")} Cache */
/** @typedef {import("./CacheFacade")} CacheFacade */
+/** @typedef {import("./Chunk").ChunkId} ChunkId */
/** @typedef {import("./ChunkGroup").ChunkGroupOptions} ChunkGroupOptions */
/** @typedef {import("./Compiler")} Compiler */
+/** @typedef {import("./Compiler").CompilationParams} CompilationParams */
/** @typedef {import("./DependenciesBlock")} DependenciesBlock */
-/** @typedef {import("./Dependency")} Dependency */
/** @typedef {import("./Dependency").DependencyLocation} DependencyLocation */
/** @typedef {import("./Dependency").ReferencedExport} ReferencedExport */
/** @typedef {import("./DependencyTemplate")} DependencyTemplate */
/** @typedef {import("./Entrypoint").EntryOptions} EntryOptions */
+/** @typedef {import("./Module").BuildInfo} BuildInfo */
+/** @typedef {import("./NormalModule").NormalModuleCompilationHooks} NormalModuleCompilationHooks */
/** @typedef {import("./Module").CodeGenerationResult} CodeGenerationResult */
/** @typedef {import("./ModuleFactory")} ModuleFactory */
+/** @typedef {import("./ModuleGraphConnection")} ModuleGraphConnection */
/** @typedef {import("./ModuleFactory").ModuleFactoryCreateDataContextInfo} ModuleFactoryCreateDataContextInfo */
+/** @typedef {import("./ModuleFactory").ModuleFactoryResult} ModuleFactoryResult */
/** @typedef {import("./RequestShortener")} RequestShortener */
/** @typedef {import("./RuntimeModule")} RuntimeModule */
/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry */
@@ -102,20 +117,46 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsAsset} StatsAsset */
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsError} StatsError */
/** @typedef {import("./stats/DefaultStatsFactoryPlugin").StatsModule} StatsModule */
+/** @typedef {import("./TemplatedPathPlugin").TemplatePath} TemplatePath */
/** @typedef {import("./util/Hash")} Hash */
-/** @template T @typedef {import("./util/deprecation").FakeHook} FakeHook */
+/**
+ * @template T
+ * @typedef {import("./util/deprecation").FakeHook} FakeHook
+ */
/** @typedef {import("./util/runtime").RuntimeSpec} RuntimeSpec */
-
+/** @typedef {WeakMap} References */
+/** @typedef {import("./util/fs").InputFileSystem} InputFileSystem */
/**
* @callback Callback
- * @param {WebpackError=} err
+ * @param {(WebpackError | null)=} err
* @returns {void}
*/
/**
* @callback ModuleCallback
- * @param {WebpackError=} err
- * @param {Module=} result
+ * @param {(WebpackError | null)=} err
+ * @param {(Module | null)=} result
+ * @returns {void}
+ */
+
+/**
+ * @callback ModuleFactoryResultCallback
+ * @param {(WebpackError | null)=} err
+ * @param {ModuleFactoryResult=} result
+ * @returns {void}
+ */
+
+/**
+ * @callback ModuleOrFactoryResultCallback
+ * @param {(WebpackError | null)=} err
+ * @param {Module | ModuleFactoryResult=} result
+ * @returns {void}
+ */
+
+/**
+ * @callback ExecuteModuleCallback
+ * @param {WebpackError | null} err
+ * @param {ExecuteModuleResult=} result
* @returns {void}
*/
@@ -129,20 +170,20 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {Record} CompilationAssets */
/**
- * @typedef {Object} AvailableModulesChunkGroupMapping
+ * @typedef {object} AvailableModulesChunkGroupMapping
* @property {ChunkGroup} chunkGroup
* @property {Set} availableModules
* @property {boolean} needCopy
*/
/**
- * @typedef {Object} DependenciesBlockLike
+ * @typedef {object} DependenciesBlockLike
* @property {Dependency[]} dependencies
* @property {AsyncDependenciesBlock[]} blocks
*/
/**
- * @typedef {Object} ChunkPathData
+ * @typedef {object} ChunkPathData
* @property {string|number} id
* @property {string=} name
* @property {string} hash
@@ -152,29 +193,68 @@ const { isSourceEqual } = require("./util/source");
*/
/**
- * @typedef {Object} ChunkHashContext
+ * @typedef {object} ChunkHashContext
+ * @property {CodeGenerationResults} codeGenerationResults results of code generation
* @property {RuntimeTemplate} runtimeTemplate the runtime template
* @property {ModuleGraph} moduleGraph the module graph
* @property {ChunkGraph} chunkGraph the chunk graph
*/
/**
- * @typedef {Object} EntryData
+ * @typedef {object} RuntimeRequirementsContext
+ * @property {ChunkGraph} chunkGraph the chunk graph
+ * @property {CodeGenerationResults} codeGenerationResults the code generation results
+ */
+
+/**
+ * @typedef {object} ExecuteModuleOptions
+ * @property {EntryOptions=} entryOptions
+ */
+
+/**
+ * @typedef {object} ExecuteModuleResult
+ * @property {any} exports
+ * @property {boolean} cacheable
+ * @property {Map} assets
+ * @property {LazySet} fileDependencies
+ * @property {LazySet} contextDependencies
+ * @property {LazySet} missingDependencies
+ * @property {LazySet} buildDependencies
+ */
+
+/**
+ * @typedef {object} ExecuteModuleArgument
+ * @property {Module} module
+ * @property {{ id: string, exports: any, loaded: boolean }=} moduleObject
+ * @property {any} preparedInfo
+ * @property {CodeGenerationResult} codeGenerationResult
+ */
+
+/**
+ * @typedef {object} ExecuteModuleContext
+ * @property {Map} assets
+ * @property {Chunk} chunk
+ * @property {ChunkGraph} chunkGraph
+ * @property {function(string): any=} __webpack_require__
+ */
+
+/**
+ * @typedef {object} EntryData
* @property {Dependency[]} dependencies dependencies of the entrypoint that should be evaluated at startup
* @property {Dependency[]} includeDependencies dependencies of the entrypoint that should be included but not evaluated
* @property {EntryOptions} options options of the entrypoint
*/
/**
- * @typedef {Object} LogEntry
+ * @typedef {object} LogEntry
* @property {string} type
- * @property {any[]} args
+ * @property {any[]=} args
* @property {number} time
* @property {string[]=} trace
*/
/**
- * @typedef {Object} KnownAssetInfo
+ * @typedef {object} KnownAssetInfo
* @property {boolean=} immutable true, if the asset can be long term cached forever (contains a hash)
* @property {boolean=} minimized whether the asset is minimized
* @property {string | string[]=} fullhash the value(s) of the full hash used for this asset
@@ -191,22 +271,24 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {KnownAssetInfo & Record} AssetInfo */
+/** @typedef {{ path: string, info: AssetInfo }} InterpolatedPathAndAssetInfo */
+
/**
- * @typedef {Object} Asset
+ * @typedef {object} Asset
* @property {string} name the filename of the asset
* @property {Source} source source of the asset
* @property {AssetInfo} info info about the asset
*/
/**
- * @typedef {Object} ModulePathData
+ * @typedef {object} ModulePathData
* @property {string|number} id
* @property {string} hash
* @property {function(number): string=} hashWithLength
*/
/**
- * @typedef {Object} PathData
+ * @typedef {object} PathData
* @property {ChunkGraph=} chunkGraph
* @property {string=} hash
* @property {function(number): string=} hashWithLength
@@ -224,7 +306,7 @@ const { isSourceEqual } = require("./util/source");
*/
/**
- * @typedef {Object} KnownNormalizedStatsOptions
+ * @typedef {object} KnownNormalizedStatsOptions
* @property {string} context
* @property {RequestShortener} requestShortener
* @property {string} chunksSort
@@ -268,49 +350,70 @@ const { isSourceEqual } = require("./util/source");
/** @typedef {KnownNormalizedStatsOptions & Omit & Record} NormalizedStatsOptions */
/**
- * @typedef {Object} KnownCreateStatsOptionsContext
+ * @typedef {object} KnownCreateStatsOptionsContext
* @property {boolean=} forToString
*/
-/** @typedef {KnownCreateStatsOptionsContext & Record} CreateStatsOptionsContext */
+/** @typedef {Record & KnownCreateStatsOptionsContext} CreateStatsOptionsContext */
+
+/** @typedef {{module: Module, hash: string, runtime: RuntimeSpec, runtimes: RuntimeSpec[]}[]} CodeGenerationJobs */
+
+/** @typedef {{javascript: ModuleTemplate}} ModuleTemplates */
+
+/** @typedef {Set} NotCodeGeneratedModules */
+
+/** @typedef {string | Set | undefined} ValueCacheVersion */
/** @type {AssetInfo} */
const EMPTY_ASSET_INFO = Object.freeze({});
const esmDependencyCategory = "esm";
+
// TODO webpack 6: remove
const deprecatedNormalModuleLoaderHook = util.deprecate(
- compilation => {
- return require("./NormalModule").getCompilationHooks(compilation).loader;
- },
+ /**
+ * @param {Compilation} compilation compilation
+ * @returns {NormalModuleCompilationHooks["loader"]} hooks
+ */
+ compilation =>
+ require("./NormalModule").getCompilationHooks(compilation).loader,
"Compilation.hooks.normalModuleLoader was moved to NormalModule.getCompilationHooks(compilation).loader",
"DEP_WEBPACK_COMPILATION_NORMAL_MODULE_LOADER_HOOK"
);
-const byId = compareSelect(
- /**
- * @param {Chunk} c chunk
- * @returns {number | string} id
- */ c => c.id,
- compareIds
-);
+// TODO webpack 6: remove
+/**
+ * @param {ModuleTemplates | undefined} moduleTemplates module templates
+ */
+const defineRemovedModuleTemplates = moduleTemplates => {
+ Object.defineProperties(moduleTemplates, {
+ asset: {
+ enumerable: false,
+ configurable: false,
+ get: () => {
+ throw new WebpackError(
+ "Compilation.moduleTemplates.asset has been removed"
+ );
+ }
+ },
+ webassembly: {
+ enumerable: false,
+ configurable: false,
+ get: () => {
+ throw new WebpackError(
+ "Compilation.moduleTemplates.webassembly has been removed"
+ );
+ }
+ }
+ });
+ moduleTemplates = undefined;
+};
+
+const byId = compareSelect(c => c.id, compareIds);
const byNameOrHash = concatComparators(
- compareSelect(
- /**
- * @param {Compilation} c compilation
- * @returns {string} name
- */
- c => c.name,
- compareIds
- ),
- compareSelect(
- /**
- * @param {Compilation} c compilation
- * @returns {string} hash
- */ c => c.fullHash,
- compareIds
- )
+ compareSelect(c => c.name, compareIds),
+ compareSelect(c => c.fullHash, compareIds)
);
const byMessage = compareSelect(err => `${err.message}`, compareStringsNumeric);
@@ -324,20 +427,33 @@ const byLocation = compareSelect(err => err.loc, compareLocations);
const compareErrors = concatComparators(byModule, byLocation, byMessage);
+/** @type {WeakMap} */
+const unsafeCacheDependencies = new WeakMap();
+
+/** @type {WeakMap} */
+const unsafeCacheData = new WeakMap();
+
class Compilation {
/**
* Creates an instance of Compilation.
* @param {Compiler} compiler the compiler which created the compilation
+ * @param {CompilationParams} params the compilation parameters
*/
- constructor(compiler) {
+ constructor(compiler, params) {
+ this._backCompat = compiler._backCompat;
+
const getNormalModuleLoader = () => deprecatedNormalModuleLoaderHook(this);
/** @typedef {{ additionalAssets?: true | Function }} ProcessAssetsAdditionalOptions */
/** @type {AsyncSeriesHook<[CompilationAssets], ProcessAssetsAdditionalOptions>} */
const processAssetsHook = new AsyncSeriesHook(["assets"]);
let savedAssets = new Set();
+ /**
+ * @param {CompilationAssets} assets assets
+ * @returns {CompilationAssets} new assets
+ */
const popNewAssets = assets => {
- let newAssets = undefined;
+ let newAssets;
for (const file of Object.keys(assets)) {
if (savedAssets.has(file)) continue;
if (newAssets === undefined) {
@@ -358,12 +474,13 @@ class Compilation {
const { fn, additionalAssets, ...remainingTap } = tap;
const additionalAssetsFn =
additionalAssets === true ? fn : additionalAssets;
- let processedAssets = undefined;
+ const processedAssets = additionalAssetsFn ? new WeakSet() : undefined;
switch (type) {
case "sync":
if (additionalAssetsFn) {
this.hooks.processAdditionalAssets.tap(name, assets => {
- if (processedAssets === this.assets) additionalAssetsFn(assets);
+ if (processedAssets.has(this.assets))
+ additionalAssetsFn(assets);
});
}
return {
@@ -372,10 +489,11 @@ class Compilation {
fn: (assets, callback) => {
try {
fn(assets);
- } catch (e) {
- return callback(e);
+ } catch (err) {
+ return callback(err);
}
- processedAssets = this.assets;
+ if (processedAssets !== undefined)
+ processedAssets.add(this.assets);
const newAssets = popNewAssets(assets);
if (newAssets !== undefined) {
this.hooks.processAdditionalAssets.callAsync(
@@ -392,7 +510,7 @@ class Compilation {
this.hooks.processAdditionalAssets.tapAsync(
name,
(assets, callback) => {
- if (processedAssets === this.assets)
+ if (processedAssets.has(this.assets))
return additionalAssetsFn(assets, callback);
callback();
}
@@ -403,7 +521,8 @@ class Compilation {
fn: (assets, callback) => {
fn(assets, err => {
if (err) return callback(err);
- processedAssets = this.assets;
+ if (processedAssets !== undefined)
+ processedAssets.add(this.assets);
const newAssets = popNewAssets(assets);
if (newAssets !== undefined) {
this.hooks.processAdditionalAssets.callAsync(
@@ -419,7 +538,7 @@ class Compilation {
case "promise":
if (additionalAssetsFn) {
this.hooks.processAdditionalAssets.tapPromise(name, assets => {
- if (processedAssets === this.assets)
+ if (processedAssets.has(this.assets))
return additionalAssetsFn(assets);
return Promise.resolve();
});
@@ -430,7 +549,8 @@ class Compilation {
const p = fn(assets);
if (!p || !p.then) return p;
return p.then(() => {
- processedAssets = this.assets;
+ if (processedAssets !== undefined)
+ processedAssets.add(this.assets);
const newAssets = popNewAssets(assets);
if (newAssets !== undefined) {
return this.hooks.processAdditionalAssets.promise(
@@ -456,14 +576,20 @@ class Compilation {
* @returns {FakeHook, "tap" | "tapAsync" | "tapPromise" | "name">>} fake hook which redirects
*/
const createProcessAssetsHook = (name, stage, getArgs, code) => {
- const errorMessage = reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
+ if (!this._backCompat && code) return;
+ /**
+ * @param {string} reason reason
+ * @returns {string} error message
+ */
+ const errorMessage =
+ reason => `Can't automatically convert plugin using Compilation.hooks.${name} to Compilation.hooks.processAssets because ${reason}.
BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a single Compilation.hooks.processAssets hook.`;
const getOptions = options => {
if (typeof options === "string") options = { name: options };
if (options.stage) {
throw new Error(errorMessage("it's using the 'stage' option"));
}
- return { ...options, stage: stage };
+ return { ...options, stage };
};
return createFakeHook(
{
@@ -521,6 +647,11 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
"runtime"
]),
+ /** @type {SyncHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */
+ executeModule: new SyncHook(["options", "context"]),
+ /** @type {AsyncParallelHook<[ExecuteModuleArgument, ExecuteModuleContext]>} */
+ prepareModuleExecution: new AsyncParallelHook(["options", "context"]),
+
/** @type {AsyncSeriesHook<[Iterable]>} */
finishModules: new AsyncSeriesHook(["modules"]),
/** @type {AsyncSeriesHook<[Module]>} */
@@ -532,22 +663,27 @@ BREAKING CHANGE: Asset processing hooks in Compilation has been merged into a si
/** @type {SyncHook<[]>} */
beforeChunks: new SyncHook([]),
- /** @type {SyncHook<[Iterable]>} */
+ /**
+ * The `afterChunks` hook is called directly after the chunks and module graph have
+ * been created and before the chunks and modules have been optimized. This hook is useful to
+ * inspect, analyze, and/or modify the chunk graph.
+ * @type {SyncHook<[Iterable