@@ -40,13 +40,11 @@ class LiteCardPlugin {
4040 pathSrc = pathSrc . replace ( / \\ / g, '/' )
4141 const moduleGraph = compilation . moduleGraph
4242 for ( const chunk of compilation . chunks ) {
43- const entryModule = chunk . entryModule
43+ const entryModule = this . getEntryModule ( compilation , chunk )
4444 if ( ! entryModule ) {
45- // console.log('=== LiteCardPlugin no entry module:', chunk.name, entryModule)
4645 continue
4746 }
4847 const { rawRequest : entryRawRequest , request } = entryModule
49- // console.log('LiteCardPlugin >>> entryRawRequest:', entryRawRequest)
5048 if ( this . isLightCard ( entryRawRequest ) ) {
5149 const { templateFileName, cssFileName, bundleFilePath } = this . getLightCardBuildPath (
5250 request ,
@@ -259,6 +257,17 @@ class LiteCardPlugin {
259257 cssFileName : `${ bundleFilePath } .css.json`
260258 }
261259 }
260+
261+ getEntryModule ( compilation , chunk ) {
262+ const chunkModules = compilation . chunkGraph . getChunkModules ( chunk )
263+ for ( let i = 0 ; i < chunkModules . length ; i ++ ) {
264+ const module = chunkModules [ i ]
265+ if ( compilation . chunkGraph . isEntryModuleInChunk ( module , chunk ) ) {
266+ return module
267+ }
268+ }
269+ return null
270+ }
262271}
263272
264273const componentIdMap = new Map ( )
0 commit comments