sysgears / webpack-virtual-modules

Webpack Virtual Modules is a webpack plugin that lets you create, modify, and delete in-memory files in a way that webpack treats them as if they were physically presented in the file system.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[Bug] Compatibility with AngularCompilerPlugin

edusperoni opened this issue · comments

  • 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)

Closing the issue as stale, please retest on latest webpack-virtual-modules and reopen with reproduction steps if the issue still exists.