badgers-ua / nx-react-pwa

Plugin for nx.dev that adds offline PWA capabilities to a react app inside nx workspace
https://github.com/badgers-ua/nx-react-pwa-example
MIT License
17 stars 2 forks source link

"dependsOn is improperly configured for client:build" error when applying nx-react-pwa #3

Open maninacan opened 1 year ago

maninacan commented 1 year ago

After creating a new React app in a new NX workspace I ran the nx g @badgers-ua/nx-react-pwa:init command which appeared to go smoothly. However, when I attempt to run the build, I get the exception NX dependsOn is improperly configured for client:build which refers to line 8 of the project.json file in my apps/client directory:

{ "root": "apps/client", "sourceRoot": "apps/client/src", "projectType": "application", "targets": { "build": { "executor": "nx:run-commands", "dependsOn": ["pre-build"], "options": { "commands": [ "npx workbox-cli generateSW ./apps/client/workbox-config.js" ], "parallel": false } }, "serve": { "executor": "@nrwl/web:dev-server", "options": { "buildTarget": "client:pre-build", "hmr": true }, "configurations": { "production": { "buildTarget": "client:pre-build:production" }, "development": { "buildTarget": "client:pre-build:development" } } }, "lint": { "executor": "@nrwl/linter:eslint", "outputs": ["{options.outputFile}"], "options": { "lintFilePatterns": ["apps/client/**/*.{ts,tsx,js,jsx}"] } }, "test": { "executor": "@nrwl/jest:jest", "outputs": ["coverage/apps/client"], "options": { "jestConfig": "apps/client/jest.config.js", "passWithNoTests": true } }, "pre-build": { "executor": "@nrwl/web:webpack", "outputs": ["{options.outputPath}"], "defaultConfiguration": "production", "options": { "compiler": "babel", "outputPath": "dist/apps/client", "index": "apps/client/src/index.html", "baseHref": "/", "main": "apps/client/src/main.tsx", "polyfills": "apps/client/src/polyfills.ts", "tsConfig": "apps/client/tsconfig.app.json", "assets": [ "apps/client/src/favicon.ico", "apps/client/src/assets", "apps/client/src/robots.txt", "apps/client/src/manifest.json" ], "styles": ["apps/client/src/styles.css"], "scripts": [], "webpackConfig": "@nrwl/react/plugins/webpack" }, "configurations": { "production": { "fileReplacements": [ { "replace": "apps/client/src/environments/environment.ts", "with": "apps/client/src/environments/environment.prod.ts" } ], "optimization": true, "outputHashing": "all", "sourceMap": false, "namedChunks": false, "extractLicenses": true, "vendorChunk": false } } } }, "tags": [] }

I'm not sure what the fix is. Please help.

badger-ua commented 1 year ago

Hello @maninacan, I'm having an working example app here https://github.com/badgers-ua/nx-react-pwa-example you could try compare your apps/client and it's project.json with an example, there might be something that differs

maninacan commented 1 year ago

Thank you!