diff --git a/.cspell.json b/.cspell.json index c79593fbea6..565018f91da 100644 --- a/.cspell.json +++ b/.cspell.json @@ -106,7 +106,8 @@ "Zenitsu", "quickstart", "pinia", - "watchpack" + "watchpack", + "zsh" ], "dictionaries": ["npm", "software-terms"], "ignorePaths": [ diff --git a/.github/workflows/dependabot.yml b/.github/workflows/dependabot.yml index 2b7803c8d63..87c8c0ce1fe 100644 --- a/.github/workflows/dependabot.yml +++ b/.github/workflows/dependabot.yml @@ -12,7 +12,7 @@ jobs: if: github.actor == 'dependabot[bot]' steps: - name: Generate Token - uses: actions/create-github-app-token@bcd2ba49218906704ab6c1aa796996da409d3eb1 # v3.2.0 + uses: actions/create-github-app-token@64ab729a6294000f5aa4a4bc0b73d1f32bc45510 # v3.3.0 id: app-token with: app-id: ${{ secrets.BOT_APP_ID }} diff --git a/.github/workflows/nodejs.yml b/.github/workflows/nodejs.yml index f5cf3c26003..a3edb719f1f 100644 --- a/.github/workflows/nodejs.yml +++ b/.github/workflows/nodejs.yml @@ -10,6 +10,18 @@ on: - main - next +# A new commit supersedes the previous one's jobs, so stop paying for them +# across the whole matrix below. Only pull request runs share a group; every +# other run gets a group of its own (`github.run_id`), because a group holds +# at most one pending run and a later push would otherwise evict the one +# waiting — `cancel-in-progress` protects the running run, not the queued one. +# Runs for the branches this also builds on push publish the coverage later +# comparisons are measured against, and losing one would also hide a breakage +# that is already on the branch. +concurrency: + group: ${{ github.workflow }}-${{ github.event_name == 'pull_request' && github.ref || github.run_id }} + cancel-in-progress: ${{ github.event_name == 'pull_request' }} + permissions: contents: read @@ -19,10 +31,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: lint-${{ github.ref }} - cancel-in-progress: true - strategy: matrix: os: [ubuntu-latest] @@ -34,7 +42,7 @@ jobs: uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Setup Node.js v${{ matrix.node-version }} - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node-version }} cache: "npm" @@ -53,15 +61,11 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: test-${{ matrix.os }}-v${{ matrix.node-version }}-${{ matrix.webpack-version }}-${{ matrix.dev-server-version }}-${{ github.ref }} - cancel-in-progress: true - strategy: fail-fast: true matrix: os: [ubuntu-latest, windows-latest, macos-latest] - node-version: [20.x, 22.x, 24.x, 25.x, 26.x] + node-version: [20.x, 22.x, 24.x, 26.x] webpack-version: [latest] dev-server-version: [5, latest] @@ -72,13 +76,13 @@ jobs: fetch-depth: 0 - name: Using Node.js v${{ matrix.node-version }} - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node-version }} cache: "npm" - name: Install pnpm - uses: pnpm/action-setup@0977fd99725f1db4007ccb2928dbb4e90d06cc86 #6.0.10 + uses: pnpm/action-setup@ea17c68df8912ef543352723c149a84f56e3d413 #6.1.0 with: version: 10 @@ -100,7 +104,7 @@ jobs: NODE_OPTIONS: --max-old-space-size=4096 - name: Upload coverage to Codecov - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: token: ${{ secrets.CODECOV_TOKEN }} @@ -109,10 +113,6 @@ jobs: runs-on: ${{ matrix.os }} - concurrency: - group: smoketests-${{ github.ref }} - cancel-in-progress: true - strategy: matrix: os: [ubuntu-latest] @@ -125,7 +125,7 @@ jobs: fetch-depth: 0 - name: Using Node.js v${{ matrix.node-version }} - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node-version }} cache: "npm" @@ -140,6 +140,6 @@ jobs: run: npm run test:smoketests - name: Upload coverage to Codecov - uses: codecov/codecov-action@fb8b3582c8e4def4969c97caa2f19720cb33a72f # v7.0.0 + uses: codecov/codecov-action@303a32d7a59b442fa8d48b6a1cc6825c09c847a5 # v7.1.1 with: token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/publish-to-pkg-pr-new.yml b/.github/workflows/publish-to-pkg-pr-new.yml index 0f4f967aa28..f75fa9732fa 100644 --- a/.github/workflows/publish-to-pkg-pr-new.yml +++ b/.github/workflows/publish-to-pkg-pr-new.yml @@ -30,7 +30,7 @@ jobs: fetch-depth: 0 - name: Setup Node.js - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: lts/* cache: "npm" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a9f13eeb5e4..719c24576b6 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,7 +23,7 @@ jobs: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 - name: Use Node.js - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: lts/* cache: npm @@ -32,7 +32,7 @@ jobs: - name: Create Release Pull Request or Publish to npm id: changesets - uses: changesets/action@198f833dd7d863100ea6e28967bc9a9fdefadb0a # v2.1.0 + uses: changesets/action@ae32849d5ba541f9ae29e40e22a623bc13562f51 # v2.1.2 with: version-script: npm run version publish-script: npm run release diff --git a/.github/workflows/update-docs.yml b/.github/workflows/update-docs.yml index 46c593a1c3d..1431ea9e912 100644 --- a/.github/workflows/update-docs.yml +++ b/.github/workflows/update-docs.yml @@ -26,7 +26,7 @@ jobs: fetch-depth: 0 - name: Using Node.js v${{ matrix.node-version }} - uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0 + uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0 with: node-version: ${{ matrix.node-version }} cache: "npm" diff --git a/.prettierignore b/.prettierignore index d9e48ba2fd2..74f76e5d54c 100644 --- a/.prettierignore +++ b/.prettierignore @@ -11,6 +11,7 @@ test/build/config/error-commonjs/syntax-error.js test/build/config/error-array/webpack.config.js test/build/config/error-mjs/syntax-error.mjs test/configtest/with-config-path/syntax-error.config.js +test/serve/error-handling/src/syntax-error.js test/build/build-errors/stats.json /.nx/workspace-data \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index e69977dace3..e8dc883569e 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,23 @@ # Change Log +## 7.3.0 + +### Minor Changes + +- feat: run `webpack-dev-server@6` as a compiler plugin. The CLI drives watch compilation, prints build stats and closes the compiler on shutdown. Older dev servers continue to manage their own compilation. (by [@bjohansebas](https://github.com/bjohansebas) in [#4847](https://github.com/webpack/webpack-cli/pull/4847)) + + In multi-compiler mode, every dev server serves all compilers by default. Use the new `--dev-server-per-compiler` option of `webpack serve` to serve each compiler only by the dev server from its own configuration. + +- feat: add shell completions for zsh, bash, fish and powershell through the `complete` command (by [@alexander-akait](https://github.com/alexander-akait) in [#4840](https://github.com/webpack/webpack-cli/pull/4840)) + +### Patch Changes + +- fix: keep multi-compiler options such as `parallelism` and `plugins` set on a configuration array when `--config-name` or `extends` rebuild it (by [@alexander-akait](https://github.com/alexander-akait) in [#4871](https://github.com/webpack/webpack-cli/pull/4871)) + +- perf: share the compile cache with child processes and worker threads, such as minimizer workers, so they start warm too (by [@alexander-akait](https://github.com/alexander-akait) in [#4872](https://github.com/webpack/webpack-cli/pull/4872)) + +- fix: assign distinct ports to dev servers of configurations that share the same `devServer` object. (by [@alexander-akait](https://github.com/alexander-akait) in [#4886](https://github.com/webpack/webpack-cli/pull/4886)) + ## 7.2.3 ### Patch Changes diff --git a/OPTIONS.md b/OPTIONS.md index 341b0d5ad71..bdeed49170e 100644 --- a/OPTIONS.md +++ b/OPTIONS.md @@ -72,7 +72,7 @@ Options --dotenv-template-reset Clear all items provided in 'dotenv.template' configuration. Template patterns for .env file names. Use [mode] as placeholder for the webpack mode. Defaults to ['.env', '.env.local', '.env.[mode]', '.env.[mode].local']. --entry A module that is loaded upon startup. Only the last one is exported. --entry-reset Clear all items provided in 'entry' configuration. All modules are loaded upon startup. The last one is exported. - --experiments-async-web-assembly Support WebAssembly as asynchronous EcmaScript Module. + --experiments-async-web-assembly [value] Enable the built-in async WebAssembly support only when no loader is registered for WebAssembly files. Enable/disable the built-in async WebAssembly support. --no-experiments-async-web-assembly Negative 'experiments-async-web-assembly' option. --experiments-back-compat Enable backward-compat layer with deprecation warnings for many webpack 4 APIs. --no-experiments-back-compat Negative 'experiments-back-compat' option. @@ -88,13 +88,13 @@ Options --no-experiments-build-http-upgrade Negative 'experiments-build-http-upgrade' option. --experiments-cache-unaffected Enable additional in memory caching of modules that are unchanged and reference only unchanged modules. --no-experiments-cache-unaffected Negative 'experiments-cache-unaffected' option. - --experiments-css Enable css support. + --experiments-css [value] Enable the built-in CSS support only when no loader is registered for CSS files. Enable/disable the built-in CSS support. --no-experiments-css Negative 'experiments-css' option. --experiments-defer-import Enable experimental tc39 proposal https://github.com/tc39/proposal-defer-import-eval. This allows to defer execution of a module until it's first use. --no-experiments-defer-import Negative 'experiments-defer-import' option. --experiments-future-defaults Apply defaults of next major version. --no-experiments-future-defaults Negative 'experiments-future-defaults' option. - --experiments-html Enable HTML entry support. Treats `.html` files as a first-class module type so they can be used directly as entry points. + --experiments-html [value] Enable the built-in HTML support only when no loader is registered for HTML files. Enable/disable the built-in HTML support. --no-experiments-html Negative 'experiments-html' option. --experiments-lazy-compilation Compile entrypoints and import()s only when they are accessed. --no-experiments-lazy-compilation Negative 'experiments-lazy-compilation' option. @@ -108,13 +108,13 @@ Options --experiments-lazy-compilation-imports Enable/disable lazy compilation for import() modules. --no-experiments-lazy-compilation-imports Negative 'experiments-lazy-compilation-imports' option. --experiments-lazy-compilation-test Specify which entrypoints or import()ed modules should be lazily compiled. This is matched with the imported module and not the entrypoint name. - --experiments-output-module Allow output javascript files as module source type. - --no-experiments-output-module Negative 'experiments-output-module' option. + --experiments-lazy-compilation-test-glob A glob pattern matched against a path, using `/` as path separator on every OS; a `!` prefix excludes what it matches. + --experiments-lazy-compilation-test-glob-reset Clear all items provided in 'experiments.lazyCompilation.test.glob' configuration. A list of glob patterns. --experiments-source-import Enable experimental tc39 proposal https://github.com/tc39/proposal-source-phase-imports. This allows importing modules at source phase. --no-experiments-source-import Negative 'experiments-source-import' option. --experiments-sync-web-assembly Support WebAssembly as synchronous EcmaScript Module (outdated). --no-experiments-sync-web-assembly Negative 'experiments-sync-web-assembly' option. - --experiments-typescript Enable typescript support. + --experiments-typescript [value] Enable the built-in TypeScript support only when Node.js supports it (>= 22.6) and no loader is registered for TypeScript files. Enable/disable the built-in TypeScript support. --no-experiments-typescript Negative 'experiments-typescript' option. -e, --extends Path to the configuration to be extended (only works when using webpack-cli). --extends-reset Clear all items provided in 'extends' configuration. Extend configuration from another configuration (only works when using webpack-cli). @@ -134,6 +134,10 @@ Options --no-externals-presets-electron-renderer Negative 'externals-presets-electron-renderer' option. --externals-presets-node Treat node.js built-in modules like fs, path or vm as external and load them via require() when used. --no-externals-presets-node Negative 'externals-presets-node' option. + --externals-presets-node-modules Enable or disable externalizing installed packages. + --no-externals-presets-node-modules Negative 'externals-presets-node-modules' option. + --externals-presets-node-modules-allowlist Requests matching the RegExp stay bundled. An exact request that should stay bundled. + --externals-presets-node-modules-allowlist-reset Clear all items provided in 'externalsPresets.nodeModules.allowlist' configuration. Keep these requests bundled instead of externalizing them. --externals-presets-nwjs Treat NW.js legacy nw.gui module as external and load it via require() when used. --no-externals-presets-nwjs Negative 'externals-presets-nwjs' option. --externals-presets-web Treat references to 'http(s)://...' and 'std:...' as external and load them via import when used (Note that this changes execution order as externals are executed before any other code in the chunk). @@ -142,7 +146,7 @@ Options --no-externals-presets-web-async Negative 'externals-presets-web-async' option. --externals-type Specifies the default type of externals ('amd*', 'umd*', 'system' and 'jsonp' depend on output.libraryTarget set to the same value). --ignore-warnings A RegExp to select the warning message. - --ignore-warnings-file A RegExp to select the origin file for the warning. + --ignore-warnings-file A RegExp or a glob to select the origin file for the warning. A glob matching the origin file for the warning at any depth. --ignore-warnings-message A RegExp to select the warning message. --ignore-warnings-module A RegExp to select the origin module for the warning. --ignore-warnings-reset Clear all items provided in 'ignoreWarnings' configuration. Ignore specific warnings. @@ -154,8 +158,10 @@ Options --no-infrastructure-logging-debug Negative 'infrastructure-logging-debug' option. --infrastructure-logging-debug-reset Clear all items provided in 'infrastructureLogging.debug' configuration. Enable debug logging for specific loggers. --infrastructure-logging-level Log level. + --infrastructure-logging-progress [value] Show build progress. `"auto"` shows it only for interactive terminals. This option is only used when no custom console is provided. + --no-infrastructure-logging-progress Negative 'infrastructure-logging-progress' option. --mode Enable production optimizations or development hints. - --module-expr-context-critical Enable warnings for full dynamic dependencies. + --module-expr-context-critical Enable warnings for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextCritical'. --no-module-expr-context-critical Negative 'module-expr-context-critical' option. --module-expr-context-recursive Enable recursive directory lookup for full dynamic dependencies. Deprecated: This option has moved to 'module.parser.javascript.exprContextRecursive'. --no-module-expr-context-recursive Negative 'module-expr-context-recursive' option. @@ -225,17 +231,45 @@ Options --no-module-generator-html-extract Negative 'module-generator-html-extract' option. --module-generator-json-json-parse Use `JSON.parse` when the JSON string is longer than 20 characters. --no-module-generator-json-json-parse Negative 'module-generator-json-json-parse' option. - --module-no-parse A regular expression, when matched the module is not parsed. An absolute path, when the module starts with this path it is not parsed. + --module-no-parse A regular expression, when matched the module is not parsed. An absolute path, when the module starts with this path it is not parsed. A glob, when it matches the module's resource path at any depth the module is not parsed. --module-no-parse-reset Clear all items provided in 'module.noParse' configuration. Don't parse files matching. It's matched against the full resolved request. --module-parser-asset-data-url-condition-max-size Maximum size of asset that should be inline as modules. Default: 8kb. --module-parser-css-as Configure how the CSS source is parsed: as a full stylesheet (default) or as a block's contents (e.g. the content of an HTML `style` attribute). + --module-parser-css-custom-media Enable/disable resolution of `@custom-media` at-rules (file-local build-time substitution). + --no-module-parser-css-custom-media Negative 'module-parser-css-custom-media' option. + --module-parser-css-custom-selectors Enable/disable resolution of `@custom-selector` at-rules (file-local build-time expansion to `:is(...)`). + --no-module-parser-css-custom-selectors Negative 'module-parser-css-custom-selectors' option. --module-parser-css-export-type Configure how CSS content is exported as default. + --module-parser-css-font-preload Auto-emit `` for the primary `src` URL of each `@font-face` reachable from an HTML entry's initial CSS. Only the first URL per `@font-face` is preloaded (preloading every format would double-download). Off by default; `parser.css.urlHints` rules and per-URL magic comments still override the seeded defaults. Set `output.crossOriginLoading` so the preload matches the font's CORS fetch. + --no-module-parser-css-font-preload Negative 'module-parser-css-font-preload' option. --module-parser-css-import Enable/disable `@import` at-rules handling. --no-module-parser-css-import Negative 'module-parser-css-import' option. --module-parser-css-named-exports Use ES modules named export for css exports. --no-module-parser-css-named-exports Negative 'module-parser-css-named-exports' option. --module-parser-css-url Enable/disable `url()`/`image-set()`/`src()`/`image()` functions handling. --no-module-parser-css-url Negative 'module-parser-css-url' option. + --module-parser-css-url-hints-as Default `as` attribute (script / style / font / image / …). + --module-parser-css-url-hints-exclude One default-hint rule for URL-referenced assets emitted by this parser (JS `new URL(...)`, CSS `url(...)`, HTML `` / `` / `