ZachJW34 / nx-plus

Collection of Nx Community Plugins
MIT License
302 stars 51 forks source link

seeing 'formats' is not found in schema #283

Closed gregveres closed 1 year ago

gregveres commented 1 year ago

Current Behavior

When I do a yarn build, which is: nx run-many --target=build --all --parallel=2 --formats umd-min

my project will buil dall of my libraries. Each library has a section of the project.json that looks like this:

{
  "projectType": "library",
  "sourceRoot": "libs/common/ui-html-editor/src",
  "targets": {
    "build": {
      "executor": "@nx-plus/vue:library",
      "options": {
        "formats": "umd",
        "dest": "dist/libs/common/ui-html-editor",
        "entry": "libs/common/ui-html-editor/src/index.ts",
        "tsConfig": "libs/common/ui-html-editor/tsconfig.lib.json"
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "outputs": ["{options.outputFile}"],
      "options": {
        "lintFilePatterns": ["libs/common/ui-html-editor/**/*.{ts,tsx,vue}"]
      }
    }
  },
  "tags": ["type:lib", "scope:common"]
}

Notice the options has "formats": "umd". This was done so that when building just the library, it would only build the umd output and not waste time with the other formats.

This has all been working just fine until today. I don't know what I changed that now causes the issue.

Anyway, the libraries are building fine. But when I go to build an application that includes these libraries, I get the 'formats' is not found in schema error.

The project.json for the app doesn't have a formats line in it.

{
  "projectType": "application",
  "sourceRoot": "apps/ui/src",
  "targets": {
    "build": {
      "executor": "@nx-plus/vue:browser",
      "parallel": true,
      "options": {
        "dest": "dist/apps/ui",
        "index": "apps/ui/public/index.html",
        "main": "apps/ui/src/main.ts",
        "tsConfig": "apps/ui/tsconfig.app.json",
        "transpileDependencies": ["vuetify"]
      },
      "configurations": {
        "production": {
          "mode": "production",
          "filenameHashing": true,
          "productionSourceMap": false,
          "publicPath": "/sc/",
          "css": {"extract": true, "sourceMap": false}
        }
      }
    },
    "serve": {
      "executor": "@nx-plus/vue:dev-server",
      "parallel": true,
      "options": {
        "port": 8080,
        "browserTarget": "ui:build",
        "publicPath": "/",
        "transpileDependencies": ["vuetify"],
        "devServer": {
          "https": false,
          "open": true,
          }
        }
      },
      "configurations": {
        "production": {
          "browserTarget": "ui:build:production",
          "publicPath"   : "/sc/"
        }
      }
    },
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "outputs": ["{options.outputFile}"],
      "options": { "lintFilePatterns": ["apps/ui/**/*.{ts,tsx,vue}"] }
    }
  },
  "tags": ["type:app"]
}

Expected Behavior

I expected to be able to build the app like I had in the past.

This seems to be a regression, but I really don't know what I changed that caused this issue. I think I did upgrade to 14.1 recently but I was positive that I did a build after that.

Steps to Reproduce

Failure Logs

Environment

Plugin name and version: yarn why => Found "@nx-plus/vue@14.1.0"



 >  NX   Report complete - copy this into the issue template

   Node : 16.13.2
   OS   : win32 x64
   yarn : 1.22.17

   nx : 14.1.7
   @nrwl/angular : Not Found
   @nrwl/cypress : 14.1.7
   @nrwl/detox : Not Found
   @nrwl/devkit : 14.1.7
   @nrwl/eslint-plugin-nx : 14.1.7
   @nrwl/express : Not Found
   @nrwl/jest : 14.1.7
   @nrwl/js : 14.1.7
   @nrwl/linter : 14.1.7
   @nrwl/nest : Not Found
   @nrwl/next : Not Found
   @nrwl/node : Not Found
   @nrwl/nx-cloud : Not Found
   @nrwl/nx-plugin : Not Found
   @nrwl/react : Not Found
   @nrwl/react-native : Not Found
   @nrwl/schematics : Not Found
   @nrwl/storybook : Not Found
   @nrwl/web : Not Found
   @nrwl/workspace : 14.1.7
   typescript : 4.3.5
   rxjs : 6.6.7
   ---------------------------------------
   Community plugins:
         @nx-plus/vue: 14.1.0```
gregveres commented 1 year ago

Ok, I think I figured out how to work around the issue and where the error message is coming from.

I mentioned that my yarn build was:

nx run-many --target=build --all --parallel=2 --formats umd-min

It is the --formats command line argument that is causing the problems. Becuase the vue application doesn't understand --formats so it is throwing the error.

I have no idea why this was working for the last 9 months and all of sudden stopped working. I must have upgraded something.

Anyway, I am keeping the "formats": "umd" in each of the package.json files for the libraries and removing the command line argument. Doing this seems to work.