From 4b1b840e3e574cd2260457315c57e07116f0938d Mon Sep 17 00:00:00 2001 From: Brion Date: Tue, 23 Jul 2024 13:51:28 +0530 Subject: [PATCH] Fix build artifact issues after `nx` 17 upgrade --- apps/console/project.json | 8 +++++--- apps/console/webpack.config.ts | 9 ++++++--- apps/myaccount/project.json | 6 ++++-- apps/myaccount/webpack.config.ts | 5 ++++- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/apps/console/project.json b/apps/console/project.json index 08104a5b376..e2c49ceaa2e 100644 --- a/apps/console/project.json +++ b/apps/console/project.json @@ -90,7 +90,8 @@ "optimization": false, "sourceMap": true, "vendorChunk": true, - "verbose": true + "verbose": true, + "extractCss": false }, "production": { "index": "index.jsp", @@ -100,7 +101,8 @@ "outputHashing": "all", "sourceMap": false, "extractLicenses": false, - "verbose": true + "verbose": true, + "extractCss": false } } }, @@ -212,4 +214,4 @@ } } } -} +} \ No newline at end of file diff --git a/apps/console/webpack.config.ts b/apps/console/webpack.config.ts index 2039eb1f94d..a15ef78a33d 100755 --- a/apps/console/webpack.config.ts +++ b/apps/console/webpack.config.ts @@ -561,10 +561,13 @@ module.exports = (config: WebpackOptionsNormalized, context: NxWebpackContextInt if (rule.test.toString().includes("svg") && rule.test instanceof RegExp) { rule.use instanceof Array && rule.use.forEach((item: RuleSetUseItem) => { - if (typeof item !== "string" && (item as any).loader.includes("url-loader")) { + if ( + typeof item !== "string" && + ((item as any).loader.includes("url-loader") || (item as any).loader.includes("file-loader")) + ) { (item as any).options.name = isProduction - ? `${ RELATIVE_PATHS.staticMedia }/[contenthash].[ext]` - : `${ RELATIVE_PATHS.staticMedia }/[path][name].[ext]`; + ? `${RELATIVE_PATHS.staticMedia}/[contenthash].[ext]` + : `${RELATIVE_PATHS.staticMedia}/[path][name].[ext]`; } }); } diff --git a/apps/myaccount/project.json b/apps/myaccount/project.json index 2612d78faf0..943bcafe276 100644 --- a/apps/myaccount/project.json +++ b/apps/myaccount/project.json @@ -85,7 +85,8 @@ "optimization": false, "sourceMap": true, "vendorChunk": true, - "verbose": true + "verbose": true, + "extractCss": false }, "production": { "index": "index.jsp", @@ -95,7 +96,8 @@ "outputHashing": "all", "sourceMap": false, "extractLicenses": false, - "verbose": true + "verbose": true, + "extractCss": false } } }, diff --git a/apps/myaccount/webpack.config.ts b/apps/myaccount/webpack.config.ts index 0472161db41..aef9be1948c 100644 --- a/apps/myaccount/webpack.config.ts +++ b/apps/myaccount/webpack.config.ts @@ -584,7 +584,10 @@ module.exports = (config: WebpackOptionsNormalized, context: NxWebpackContextInt if (rule.test.toString().includes("svg") && rule.test instanceof RegExp) { rule.use instanceof Array && rule.use.forEach((item: RuleSetUseItem) => { - if (typeof item !== "string" && (item as any).loader.includes("url-loader")) { + if ( + typeof item !== "string" && + ((item as any).loader.includes("url-loader") || (item as any).loader.includes("file-loader")) + ) { (item as any).options.name = isProduction ? `${RELATIVE_PATHS.staticMedia}/[contenthash].[ext]` : `${RELATIVE_PATHS.staticMedia}/[path][name].[ext]`;