Repository navigation
chore: load configuration files without eval - #4893
Conversation
TypeScript with module nodenext keeps import() in the CommonJS output, so eval is no longer needed to stop it turning into require(). Claude-Session: https://claude.ai/code/session_013FhutRFjuQemBzekJMYcqL
🦋 Changeset detectedLatest commit: 42cf33b The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
|
This PR is packaged and the instant preview is available (4a88999). Install it locally:
npm i -D webpack-cli@https://pkg.pr.new/webpack-cli@4a88999
yarn add -D webpack-cli@https://pkg.pr.new/webpack-cli@4a88999
pnpm add -D webpack-cli@https://pkg.pr.new/webpack-cli@4a88999 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #4893 +/- ##
==========================================
+ Coverage 94.95% 95.24% +0.28%
==========================================
Files 14 14
Lines 5950 5949 -1
Branches 915 916 +1
==========================================
+ Hits 5650 5666 +16
+ Misses 296 282 -14
+ Partials 4 1 -3
... and 2 files with indirect coverage changes Continue to review full report in Codecov by Harness.
🚀 New features to boost your workflow:
|
|
No actionable comments were generated in the recent review.
|
This PR contains the following updates: | Package | Change | [Age](https://docs.renovatebot.com/merge-confidence/) | [Confidence](https://docs.renovatebot.com/merge-confidence/) | |---|---|---|---| | [webpack-cli](https://github.com/webpack/webpack-cli/tree/main/packages/webpack-cli) ([source](https://github.com/webpack/webpack-cli)) | [`7.2.3` → `7.3.1`](https://renovatebot.com/diffs/npm/webpack-cli/7.2.3/7.3.1) |  |  | --- ### Release Notes <details> <summary>webpack/webpack-cli (webpack-cli)</summary> ### [`v7.3.1`](https://github.com/webpack/webpack-cli/blob/HEAD/CHANGELOG.md#731) [Compare Source](https://github.com/webpack/webpack-cli/compare/webpack-cli@7.3.0...webpack-cli@7.3.1) ##### Patch Changes - fix: detect missing package managers and failed installations, without a lock file the CLI chose npm even when it wasn't installed instead of yarn or pnpm, and it continued after a package failed to install (by [@​alexander-akait](https://github.com/alexander-akait) in [#​4889](webpack/webpack-cli#4889)) - chore: replace the `import-local` and `cross-spawn` dependencies with Node.js built-ins (by [@​alexander-akait](https://github.com/alexander-akait) in [#​4889](webpack/webpack-cli#4889)) - chore: load configuration files with `import()` instead of `eval` (by [@​alexander-akait](https://github.com/alexander-akait) in [#​4893](webpack/webpack-cli#4893)) ### [`v7.3.0`](https://github.com/webpack/webpack-cli/blob/HEAD/CHANGELOG.md#730) [Compare Source](https://github.com/webpack/webpack-cli/compare/webpack-cli@7.2.3...webpack-cli@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](webpack/webpack-cli#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](webpack/webpack-cli#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](webpack/webpack-cli#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](webpack/webpack-cli#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](webpack/webpack-cli#4886)) </details> --- ### Configuration 📅 **Schedule**: (UTC) - Branch creation - "before 9am on tuesday" - Automerge - At any time (no schedule defined) 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Mend Renovate CLI](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0NC4xODguMiIsInVwZGF0ZWRJblZlciI6IjQ0LjE4OC4yIiwidGFyZ2V0QnJhbmNoIjoiZGV2ZWxvcCIsImxhYmVscyI6WyJkZXBlbmRlbmNpZXMiLCJyZW5vdmF0ZSJdfQ==--> Reviewed-on: https://code.futo.org/harbor/harbor/pulls/2163
Configuration files were loaded with
eval(\import("…")`). That was a workaround for TypeScript compilingimport()intorequire()` in CommonJS output, which can't load ES modules.The package now compiles with
module: "nodenext", and TypeScript keepsimport()as a real dynamic import in CommonJS output. The compiledlib/webpack-cli.jsalready does this for the other dynamic imports in the same file, for example the YAML/TOML parser import next to this code. So the configuration is now loaded with a plainawait import(...), and the compiled output has noevalleft.The behavior is the same: the configuration is imported from its
file://URL, and if that fails, theinterpret/rechoirfallback still runs.Checked locally:
import(…)with noeval;create-webpack-apppasses (154 suites), including the config-format tests (ESM, CommonJS, TypeScript, Babel, CoffeeScript, YAML, TOML and others).Generated by Claude Code
Summary by CodeRabbit