webpack-virtual-modules icon indicating copy to clipboard operation
webpack-virtual-modules copied to clipboard

[Bug] Compatibility with AngularCompilerPlugin

Open edusperoni opened this issue 4 years ago • 0 comments

  • [x] I'd be willing to submit the fix

Describe the bug

With the latest AngularCompilerPlugin, virtual modules are transformed into empty files:

/***/ "./src/virtualentrypoint":
/*!*******************************!*\
  !*** ./src/virtualentrypoint ***!
  \*******************************/
/***/ (() => {

eval("\n\n//# sourceURL=webpack://my-webpack-project/./src/virtualentrypoint?");

/***/ })

Without AngularCompilerPlugin:

/***/ "./src/virtualentrypoint":
/*!*******************************!*\
  !*** ./src/virtualentrypoint ***!
  \*******************************/
/***/ (() => {

eval("console.log(\"this should appear\");\n\n//# sourceURL=webpack://my-webpack-project/./src/virtualentrypoint?");

/***/ })

To Reproduce

Minimal reproduction: https://github.com/edusperoni/ng-compiler-virtual-modules

Switch useAngularCompiler to false in webpack.config.js and it'll emit on the bundle, switch to true and it'll emit an empty file.

Environment if relevant (please complete the following information):

  • OS: Windows
  • Node version 12.19.0
  • Webpack version 5.36.2

Additional context

Related to #45. Seems to have been introduced with webpack 5 support.

Also, seems to not be an issue with Angular 12 (not yet released)

edusperoni avatar May 06 '21 10:05 edusperoni