Skip to content

NXT-20982: Upgrade dependencies to latest majors (webpack-dev-server 6, chalk 6, et al.) - #409

Open
hong6316 wants to merge 11 commits into
developfrom
feature/NXT-20982
Open

hong6316 wants to merge 11 commits into
developfrom
feature/NXT-20982

Conversation

@hong6316

Copy link
Copy Markdown
Contributor

Checklist

  • I have read and understand the contribution guide
  • A CHANGELOG entry is included
  • I have run automated testing and it is passed
  • Documentation was added or is not needed
  • This is an API breaking change

Issue Resolved / Feature Added

Updates the Enact CLI's dependencies to their latest major versions and migrates
the code/configuration accordingly. The following packages are upgraded:

  • chalk 5 → 6
  • dotenv 17 → 18, dotenv-expand 13 → 1000
  • validate-npm-package-name 7 → 8
  • @testing-library/jest-dom 6 → 7
  • less-loader 12 → 13, sass-loader 16 → 17, postcss-preset-env 10 → 11
  • webpack-dev-server 5 → 6 (and @pmmmwh/react-refresh-webpack-plugin 0.6.2 → 0.6.3)

webpack-dev-server 6 is ESM-only and requires Node.js >= 22.15, so the
supported Node engines are updated to ^22.15.0 || >=24.0.0.

Resolution

No source migration was required for most packages (chalk already uses dynamic
import(), dotenv uses config({processEnv}) + expand(), jest-dom is wired via
moduleNameMapper, the style loaders use the unchanged lessOptions/sassOptions).

Regressions surfaced by the upgrades were fixed:

  • less-loader 13 now defaults lessLogAsWarnOrErr to true, surfacing Less
    deprecations as webpack warnings that fail pack --production under CI. Set
    lessLogAsWarnOrErr: false to restore the previous silent behavior.
  • jest-environment-jsdom 30 pulls jsdom 26, where the global window
    property is non-configurable and breaks jest.spyOn(window, 'window', 'get')
    used by framework specs. This is not shimmable from a custom environment, so
    jest-environment-jsdom is kept at 29.7.0 (jsdom 20) which pairs fine with
    jest core 30.
  • webpack 5.112 relocated internal modules used by @enact/dev-utils’s DLL
    plugins. The CLI now consumes the matching @enact/dev-utils changes (see the
    companion dev-utils PR), so a single webpack copy is resolved and the framework
    bundle builds cleanly (no more module.is is not a function or
    Cannot find module 'webpack/lib/RuntimeGlobals').

Deferred (ecosystem not ready): @babel/plugin-transform-modules-commonjs 8 and
eslint 10.

Additional Considerations

Validated with the enact-release-testing-related-cli pipeline and the
downstream framework jobs (isomorphic / cli-testing / samples / screenshot /
theme-samples / ui-tests) on Node 22+. The @enact/dev-utils dependency
currently points at the feature/NXT-20982 branch and should be moved back to a
published version range once the companion dev-utils PR is released.

Links

NXT-20982

Comments

Enact-DCO-1.0-Signed-off-by: Taeyoung Hong (taeyoung.hong@lge.com)

Upgrade 9 packages to new majors:
- chalk ^5.6.2 -> ^6.0.1
- dotenv ^17.4.2 -> ^18.0.9
- dotenv-expand ^13.0.0 -> ^1000.0.0
- validate-npm-package-name ^7.0.2 -> ^8.0.0
- @testing-library/jest-dom ^6.9.1 -> ^7.0.1
- jest-environment-jsdom 29.7.0 -> 30.5.2
- less-loader ^12.3.2 -> ^13.0.0
- sass-loader ^16.0.7 -> ^17.0.1
- postcss-preset-env ^10.6.1 -> ^11.6.1

Deferred (ecosystem/engine incompat): @babel/plugin-transform-modules-commonjs@8,
eslint@10 (requires Node >=20.19, config-enact compat), webpack-dev-server@6
(SockJS removal breaks react-refresh-webpack-plugin).

No source migration required: chalk uses dynamic import(), dotenv uses
config({processEnv:{}})+expand(), jest-dom via moduleNameMapper, loaders use
lessOptions/sassOptions (unchanged across majors).
- webpack-dev-server ^5.2.5 -> ^6.1.0
- @pmmmwh/react-refresh-webpack-plugin ^0.6.2 -> ^0.6.3 (adds WDS6 peer support)
- engines.node: drop Node 20, require ^22.15.0 || >=24.0.0 (WDS6 needs >=22.15.0)

WDS6 is ESM-only but loads via require(esm) on Node >=22.15. No serve.js code
changes needed: WebpackDevServer/startCallback/stopCallback/setupMiddlewares APIs
unchanged from v5. react-dev-utils uses native WebSocket (no SockJS), so SockJS
removal in v6 has no impact. webpack 5.112.2 satisfies WDS6 peer ^5.101.0.
Three root causes surfaced by the dependency upgrades (all green on develop,
failing on this branch) are addressed:

1. 'module.is is not a function' (isomorphic/screenshot/ui-tests framework
   bundle): the pre-existing webpack bump to 5.112.2 left @enact/dev-utils
   resolving its own nested webpack 5.109.2. EnactFrameworkPlugin requires
   webpack/lib/dll/DllModule, so the DLL runtime straddled two webpack copies
   and broke. Add overrides.webpack ^5.112.2 to dedupe to a single webpack.

2. LESS build failure (samples/theme-samples): less-loader 13 defaults
   lessLogAsWarnOrErr to true, emitting Less deprecations (mixin called without
   parentheses in @enact/ui) as webpack warnings; pack --production (CI=true)
   treats warnings as errors. Set lessLogAsWarnOrErr:false to restore pre-13
   silent logging.

3. 'Property window is not declared configurable' (@enact/core specs under
   cli-testing): jest-environment-jsdom 30 pulls jsdom 26, where window.window
   is non-configurable, breaking jest.spyOn(window,'window','get'). This cannot
   be shimmed from a custom environment (the property is genuinely
   non-configurable). Revert jest-environment-jsdom to 29.7.0 (jsdom 20.0.3),
   which keeps window configurable. Verified the exact spy pattern passes.

Other upgrades retained: chalk 6, dotenv 18, dotenv-expand 1000,
validate-npm-package-name 8, @testing-library/jest-dom 7, less-loader 13,
sass-loader 17, postcss-preset-env 11, webpack-dev-server 6,
react-refresh-webpack-plugin 0.6.3.
Point @enact/dev-utils at enactjs/dev-utils#feature/NXT-20982, whose devDep
webpack is aligned to ^5.112.2. This dedupes webpack to the single top-level
copy naturally, so the temporary overrides.webpack ^5.112.2 workaround for the
'module.is is not a function' DLL failure (cause 1) is removed.

Verified: webpack resolves to one 5.112.2 copy (no nested dev-utils webpack),
and EnactFrameworkPlugin loads webpack/lib/dll/DllModule from the same single
webpack instance the CLI compiles with.
Update the pinned @enact/dev-utils commit to include the public-API
RuntimeGlobals change (enactjs/dev-utils@57b0a78), fixing the framework build
failure 'Cannot find module webpack/lib/RuntimeGlobals' on webpack 5.112.
Pin @enact/dev-utils to enactjs/dev-utils@663a65f, which fixes the external
framework build failure 'Cannot find module
webpack/lib/dependencies/DelegatedSourceDependency' on webpack 5.112.
jest-environment-jsdom is pinned back to 29.7.0, matching develop, so there is
no net change to record.
Comment thread package.json
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants