Sorry for many questions…

1 minute read

Sorry for many questions, Does anyone know why if I’m building a react application with the nx serve –prod command getting a different output than through nx build –prod? In workspace.json it refers to the same build. "web-main": { "root": "apps/web-main", "sourceRoot": "apps/web-main/src", "projectType": "application", "schematics": {}, "architect": { "build": { "builder": "@nrwl/web:build", "options": { "outputPath": "dist/apps/web-main", "index": "apps/web-main/src/index.html", "main": "apps/web-main/src/main.tsx", "polyfills": "apps/web-main/src/polyfills.ts", "tsConfig": "apps/web-main/tsconfig.app.json", "assets": [ "apps/web-main/src/favicon.ico", "apps/web-main/src/assets" ], "styles": ["apps/web-main/src/styles/app.scss"], "scripts": [], "webpackConfig": "@nrwl/react/plugins/webpack", "buildLibsFromSource": true }, "configurations": { "production": { "fileReplacements": [ { "replace": "libs/environments/src/lib/environment.ts", "with": "libs/environments/src/lib/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": false, "extractCss": true, "namedChunks": false, "extractLicenses": false, "vendorChunk": true, "budgets": [ { "type": "initial", "maximumWarning": "2mb", "maximumError": "20mb" } ] } } }, "serve": { "builder": "@nrwl/web:dev-server", "options": { "buildTarget": "web-main:build" }, "configurations": { "production": { "buildTarget": "web-main:build:production" } } }, "lint": { "builder": "@nrwl/linter:lint", "options": { "linter": "eslint", "config": "apps/web-main/.eslintrc", "tsConfig": ["apps/web-main/tsconfig.app.json", "apps/web-main/tsconfig.spec.json"], "exclude": ["**/node_modules/**", "!apps/web-main/**"] } }, "test": { "builder": "@nrwl/jest:jest", "options": { "jestConfig": "apps/web-main/jest.config.js", "tsConfig": "apps/web-main/tsconfig.spec.json", "passWithNoTests": true } } } }

Responses:

What appears to be the issue. Server –prod isn;t the same thing but simular. Server prod wont show max eceed limit warning.

You can also see that nx serve –prod has better optimized files than build

Updated: