Closed
Description
When running a build, I observed that assets are also copied into the server dist folder. This seems superfluous, as server build will always take any assets including index.html from the browser dist folder.
As copying the assets to server dist folder just wastes precious build time and also increases build artifacts needlessly, including assets for server build should be prevented.
I fixed that temporarily by monkey-patching angular-rspack:
--- a/node_modules/@nx/angular-rspack/dist/lib/plugins/ng-rspack.js
+++ b/node_modules/@nx/angular-rspack/dist/lib/plugins/ng-rspack.js
@@ -42,7 +42,7 @@ class NgRspackPlugin {
ngHmrMode: this.pluginOptions.devServer?.hmr && isDevServer ? 'true' : 'false',
...(this.pluginOptions.define ?? {}),
}).apply(compiler);
- if (this.pluginOptions.assets) {
+ if (this.pluginOptions.assets && !this.isPlatformServer) {
new core_1.CopyRspackPlugin({
patterns: (this.pluginOptions.assets ?? []).map((asset) => {
let { input, output = '' } = asset;