Closed deleonio closed 3 years ago
In the angular 9 example project that I have access to, I have just tried upgrading copy-modules-webpack-plugin to v2.2.0 and rebuilding and it had no issue. This may be a problem in your leanup code or somewhere else.
@rpokorny
That sounds good. Is it possible for your to share the relevant parts of your webpack.config.js with us?
You can see the setup here: https://github.com/hboutemy/angular9-example-app . It uses @angular-builders/custom-webpack:browser
and the actual webpack config is quite simple, containing only the copy-modules-webpack-plugin
settings.
Hi @rpokorny,
we does not use the Angular CLI - we use for the angular framework the @ngtools/webpack
Webpack plugin. The @leanup Stack seeks to be as uniform as possible across all frameworks.
I have invest somt time to debug the issue. I see that the files extension is in the emit method "JS" instead "TS". So all src files are not found.
The big question is - why is that different by @angular to all other frameworks.
Exact the same index.js module file for copy-modules-webpack-plugin for @facebook react.
No warnings and no errors.
I have investigated this by checking out the demo project here and making some tweaks. From what I can tell, angular adds non-existent paths to the fileDependencies
collection, but also keeps all of the relevant real paths in the collection. This means that all we need to do is check for file existence before calling lstat
in order to avoid the error. I have created a PR which does that, please let me know if those changes work for you.
@deleonio since you mentioned in #27 that you were using Angular 11 along with @ngtools/webpack
, I have attempted to create a demo project that follows that setup in the hopes of reproducing the issue. You can find that repo here: https://github.com/rpokorny/angular-11-playground. Unfortunately, I was not able to reproduce. That demo project builds successfully, in the sense that webpack reports no errors and the copy-modules-webpack-plugin does run and copy files as expected. Could you take a look and see what difference between that repo and your work might explain the difference in behavior? One thing I notice is that the file which you show triggering the error, angular.main.ts
, does not exist in the starter-app files that I generated in my repo using ng new
. Where did your angular.main.ts
file come from? FWIW that repo uses webpack 5. What webpack version were you using?
Closing as unable to reproduce
Sorry - this case I does not test before - I checked it with my react or preact projects.
But: https://github.com/deleonio/poc-flexible-web-application-architecture/actions/runs/464487469
Angular does not build anymore - but I dont know why.
If I remove the plugin the build works.
Reproduce:
Remove plugin (
node_modules\@leanup\stack-webpack\lib\webpack.config.js
):