Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: update deprecated API for webpack modules #75

Merged
merged 1 commit into from
Nov 14, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions packages/hap-packager/src/plugins/lite-card-plugin.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,11 @@ class LiteCardPlugin {
pathSrc = pathSrc.replace(/\\/g, '/')
const moduleGraph = compilation.moduleGraph
for (const chunk of compilation.chunks) {
const entryModule = chunk.entryModule
const entryModule = this.getEntryModule(compilation, chunk)
if (!entryModule) {
// console.log('=== LiteCardPlugin no entry module:', chunk.name, entryModule)
continue
}
const { rawRequest: entryRawRequest, request } = entryModule
// console.log('LiteCardPlugin >>> entryRawRequest:', entryRawRequest)
if (this.isLightCard(entryRawRequest)) {
const { templateFileName, cssFileName, bundleFilePath } = this.getLightCardBuildPath(
request,
Expand Down Expand Up @@ -259,6 +257,17 @@ class LiteCardPlugin {
cssFileName: `${bundleFilePath}.css.json`
}
}

getEntryModule(compilation, chunk) {
const chunkModules = compilation.chunkGraph.getChunkModules(chunk)
for (let i = 0; i < chunkModules.length; i++) {
const module = chunkModules[i]
if (compilation.chunkGraph.isEntryModuleInChunk(module, chunk)) {
return module
}
}
return null
}
}

const componentIdMap = new Map()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ class WidgetFingerprintPlugin {
const widgetKey = widgetNameKeyMap[chunkName]
const widgetDigestMap = {}
const arr = []
for (const module of chunk.modulesIterable) {
for (const module of compilation.chunkGraph.getChunkModules(chunk)) {
const { _source, rawRequest, request } = module
arr.push(rawRequest)
if (!request) {
Expand Down
Loading