Skip to content

Commit

Permalink
Merge pull request #1356 from mater1996/master
Browse files Browse the repository at this point in the history
fix: 多入口找不到entryName
  • Loading branch information
hiyuki authored Dec 14, 2023
2 parents d3c6df1 + 33592de commit 9650b1d
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions packages/webpack-plugin/lib/utils/get-entry-name.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,12 @@ module.exports = function (loaderContext) {
const moduleGraph = loaderContext._compilation.moduleGraph
let entryName = ''
for (const [name, { dependencies }] of loaderContext._compilation.entries) {
const entryModule = moduleGraph.getModule(dependencies[0])
if (entryModule && entryModule.resource === loaderContext.resource) {
entryName = name
break
for (const dep of dependencies) {
const entryModule = moduleGraph.getModule(dep)
if (entryModule && entryModule.resource === loaderContext.resource) {
entryName = name
break
}
}
}
return entryName
Expand Down

0 comments on commit 9650b1d

Please sign in to comment.