Skip to content

[BUG] TypeError: Cannot read property 'assets' of undefined #11

@Nshcn

Description

@Nshcn

Describe the bug
A clear and concise description of what the bug is.

In the html-webpack-plugin, even though I have excluded this plugin, an error still occurs internally within the html-webpack-plugin. The problematic code inside the html-webpack-plugin is as follows:

// Once everything is compiled evaluate the html factory and replace it with its content
if ('compiledEntry' in templateResult) {
  const compiledEntry = templateResult.compiledEntry;
  const assets = compiledEntry.assets;

  // Store assets from child compiler to reemit them later
  for (const name in assets) {
    previousEmittedAssets.push({ name, source: assets[name].source, info: assets[name].info });
  }

  return this.evaluateCompilationResult(compiledEntry.content, assetsInformationByGroups.publicPath, this.options.template);
}

It seems that compiledEntry is undefined, causing the failure when accessing assets. I have tried my best to troubleshoot the issue but still cannot find a solution. Is there any way I can bypass this error? Please help me.

To Reproduce
Could you please provide a mini-repo to reproduce the issue?
And it will be appreciated if you could provide a README in it about the environment setup and commands that need to run.

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Additional context
Add any other context about the problem here.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions