question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Failing to clean dummy-chunk on some occasions

See original GitHub issue

Using webpack 4.x, svg-spritemap-webpack-plugin 3.3.5, Webpack configuration is something like this:

module.exports = {
    mode: "development",
    output: {
      path: path.resolve(context,"./dist"),
      filename: "code.bundle.js",
      //chunkFilename: "[id].js",
      publicPath: ""
    },
    plugins: [
      new SVGSpritemapPlugin('./editor/assets/svg/*.svg',{
        output: {
          filename: "symbol-defs.svg",
          svg4everybody: false
        },
        sprite: {
          prefix: "icon-"
        }
      })
    ]
}

If I define output.filename as a string without any placeholders, dummy module’s chunk uses that string as a postfix to define its filename. This causes the internal check to remove the dummy chunk fail.

compilation.chunks.forEach((chunk) => {
  if ( chunk.name !== outputOptions.chunk.name ) {
    return;
  }
  // chunk.name is 'spritemap' while chunk filename is 'spritemap.code.bundle.js' 
  chunk.files.filter((file) => {
    return [`${chunk.name}.js`, `${chunk.name}.js.map`].includes(file);
  }).forEach((file) => {
    delete compilation.assets[file];
  });
});

It can be easily fixed if you define a output.filename with placeholders or define output.chunkFilename. Latter is the one I preffered. Not sure if this is considered nitpicking.

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:6 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
cascornelissencommented, Jul 11, 2019

@Maiquu, a fix for this issue has been released in version 3.3.6 🚀

1reaction
cascornelissencommented, Jul 10, 2019

Thanks for your quick response as well! I’ll leave the issue open until I release a new patch version containing the fix ✌️

Read more comments on GitHub >

github_iconTop Results From Across the Web

PoC||GTFO - Alex Omar
The FAIL. Needless to say, what followed was a tense afternoon of drinking, waiting, and considering exit scenarios from a certain country,.
Read more >
Switch (back) to copying full CPython Lib until we get to a ...
(SerialCookie can yield some strange-looking cookie +values, however.) ... If it fails, then it fallsback to treating the value +as a string.
Read more >
Full text of "Your Computer Magazine (July 1985)"
Behind Sinclair *s cash crisis lie many reasons, some common to all ... If a program does not load as easily on the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found