Repository navigation
Conversation
…d require
- chalk ^5.6.2 -> ^6.0.1. No code change needed: all usages already use the
ESM-compatible dynamic import('chalk') / new Chalk() patterns.
- Remove the import-fresh dependency. import-fresh 4 is ESM-only and exposes an
asynchronous, module-loader-hook based importer, which is incompatible with
the synchronous prerender path in vdom-server-render (invoked inside webpack's
synchronous chunkAsset SyncHook). Inline the small, CommonJS-only behavior the
code relied on (resolve, drop from require.cache incl. parent linkage, require
again) so render() stays synchronous and PrerenderPlugin is unchanged.
webpack 5.112 relocated RuntimeGlobals from webpack/lib/RuntimeGlobals to
webpack/lib/runtime/RuntimeGlobals, so the deep require broke framework builds
('Cannot find module webpack/lib/RuntimeGlobals') on webpack >= 5.112. Switch
to the public API (require('webpack').RuntimeGlobals), which resolves across
webpack 5 versions. The other deep webpack/lib requires in the dll plugins
(DllEntryPlugin, DllModule, Delegated*, ExternalsPlugin) still exist in 5.112
and are left unchanged.
webpack 5.112 moved internal modules, breaking the external-framework build
('Cannot find module webpack/lib/dependencies/DelegatedSourceDependency'):
- ExternalsPlugin: use the public API require('webpack').ExternalsPlugin
(its internal path moved to lib/externals/).
- DelegatedSourceDependency: moved from lib/dependencies/ to lib/dll/. It has
no public API, so resolve it tolerantly across both locations.
- DelegatedModule: wrapped with the same tolerant resolver for robustness.
Keeps compatibility with both older (5.109) and newer (5.112+) webpack 5.
Drop the webpack 5.109 compatibility fallback and target webpack 5.112 directly: - DelegatedSourceDependency / DelegatedModule: require from lib/dll/ directly. - ExternalsPlugin / RuntimeGlobals: use the public webpack API.
chalk 6 ships a conditional `exports` map that eslint-import-resolver-node
(via eslint-plugin-import) cannot resolve, so the dynamic `import('chalk')`
calls produced false `import/no-unresolved` errors and failed the CI lint
(run with --max-warnings 0). Ignore `chalk` in the import/no-unresolved rule;
the import resolves correctly at runtime.
| }, | ||
| "peerDependencies": { | ||
| "html-webpack-plugin": ">=5.0.0", | ||
| "webpack": ">=5.0.0" |
Contributor
There was a problem hiding this comment.
we should update this, since webpack 5.112 has breaking changes
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Checklist
Issue Resolved / Feature Added
Upgrades
chalkto v6 and makes the DLL/prerender plugins compatible withwebpack 5.112, which relocated several internal modules that the framework
plugins require directly.
Resolution
dynamic
import('chalk')/new Chalk()patterns.exposes an asynchronous, module-loader-hook based importer, which is
incompatible with the synchronous prerender path in
vdom-server-render(invoked inside webpack’s synchronous
chunkAssethook). The small,CommonJS-only "uncached require" behavior it provided is inlined instead, so
render()stays synchronous andPrerenderPluginis unchanged.RuntimeGlobals: moved tolib/runtime/— now uses the public APIrequire('webpack').RuntimeGlobals.ExternalsPlugin: moved tolib/externals/— now uses the public APIrequire('webpack').ExternalsPlugin.DelegatedSourceDependency: moved fromlib/dependencies/tolib/dll/—now required from the correct path. (Targets webpack 5.112.)
Additional Considerations
Verified the DLL/prerender plugins and their require chains
(
EnactFrameworkPlugin,EnactFrameworkRefPlugin,mixins/framework.js,mixins/externals.js,index.js) load under webpack 5.112.2, with lint passing.Exercised end-to-end via the Enact CLI framework/isomorphic/screenshot/ui jobs
through the companion
@enact/cliPR.Links
NXT-20982
Comments
Enact-DCO-1.0-Signed-off-by: Taeyoung Hong (taeyoung.hong@lge.com)