(4.10.0) “Module has no id. This should not happen” when using dynamic import and sideEffects flag

Bug report

What is the current behavior?
RuntimeTemplate.moduleId(): Module <path>\packages\components\src\CompAB\CompA.js has no id. This should not happen.

If the current behavior is a bug, please provide the steps to reproduce.

This error occurs only in the following situation:

  • "sideEffects: false" is required (is set in components package.json) – if you remove it, you won’t see the error
  • Module is imported twice (using static import and dynamic import) – if you remove dynamic import of ./foo from main.js or static import of CompA – no error

What is the expected behavior?
Should compile without the error

Other relevant information:
webpack version: 4.10.0
Node.js version: 9.6.1
Operating System: Windows 10 x64
Additional tools: –

Author: Fantashit

1 thought on “(4.10.0) “Module has no id. This should not happen” when using dynamic import and sideEffects flag

  1. I’m still getting this error with webpack v4.10.1, when I try to bundle an Angular 6 app:

    ERROR in chunk app [entry]
        dist/[name].js
        C:\MyProject\node_modules\@angular\core\fesm5\core.js
        RuntimeTemplate.moduleId(): Module C:\MyProject\node_modules\rxjs\_esm5\internal\Subscription.js has no id. This should not happen.
    

    v4.9.2 works without any issues.

Comments are closed.