1) the wepback-virtual-modules plugin emits a worrying warning in Webpack 5 and, in general, doesn't seem to be super-actively developed.
2) sokra says that a loader is the correct solution: https://github.com/webpack/webpack/issues/11074#issuecomment-648658214
3) Since loaders are native/normal, this works well with watch mode and should work just fine with Webpack 5 persistent build caching.
This also includes a tricky NormalModuleReplacementPlugin() so that we can continue to handling the parsing of the user's controller.json inside this library (instead of putting the import + loader code in their app).
This will require a partner PR in webpack-encore (https://github.com/symfony/webpack-encore/pull/888). The only line users will need to change in their app is to remove import '@symfony/autoimport'; from their assets/bootstrap.js file.
Hi!
The motivation behind this was a few things:
1) the wepback-virtual-modules plugin emits a worrying warning in Webpack 5 and, in general, doesn't seem to be super-actively developed. 2) sokra says that a loader is the correct solution: https://github.com/webpack/webpack/issues/11074#issuecomment-648658214 3) Since loaders are native/normal, this works well with
watch
mode and should work just fine with Webpack 5 persistent build caching.This also includes a tricky NormalModuleReplacementPlugin() so that we can continue to handling the parsing of the user's controller.json inside this library (instead of putting the import + loader code in their app).
This will require a partner PR in webpack-encore (https://github.com/symfony/webpack-encore/pull/888). The only line users will need to change in their app is to remove
import '@symfony/autoimport';
from theirassets/bootstrap.js
file.Cheers!