ZachJW34 / nx-plus

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

Lib build error `TypeError: Cannot read property 'tapAsync' of undefined` #209

Open Aysnine opened 2 years ago

Aysnine commented 2 years ago

Current Behavior

Build failed TypeError: Cannot read property 'tapAsync' of undefined

Expected Behavior

Build.

Steps to Reproduce

Init by nx g @nx-plus/vue:lib vue-core --publishable and moved from libs to packages.

project.json :

{
  "root": "packages/vue-core",
  "sourceRoot": "packages/vue-core/src",
  "projectType": "library",
  "targets": {
    "lint": {
      "executor": "@nrwl/linter:eslint",
      "options": {
        "lintFilePatterns": [
          "packages/vue-core/**/*.{ts,tsx,vue}"
        ]
      }
    },
    "build": {
      "executor": "@nx-plus/vue:library",
      "options": {
        "dest": "dist/packages/vue-core",
        "entry": "packages/vue-core/src/index.ts",
        "tsConfig": "packages/vue-core/tsconfig.lib.json"
      }
    },
    "test": {
      "executor": "@nrwl/jest:jest",
      "outputs": [
        "coverage/packages/vue-core"
      ],
      "options": {
        "jestConfig": "packages/vue-core/jest.config.js",
        "passWithNoTests": true
      }
    }
  },
  "tags": []
}

Failure Logs

Error when nx build vue-core --verbose:

> nx run vue-core:build --verbose

⠹  Building for production as library (commonjs,umd,umd-min)...

 DONE  Compiled successfully in 2744ms                                                                                                                                                                3:55:37 PM

⠴  Building for production as library (commonjs,umd,umd-min)...

 ERROR  Failed to compile with 1 error                                                                                                                                                                3:55:38 PM

  TypeError: Cannot read property 'tapAsync' of undefined

  - ExternalModuleFactoryPlugin.js:59 ExternalModuleFactoryPlugin.apply
    [d2-craft]/[webpack]/lib/ExternalModuleFactoryPlugin.js:59:39

  - ExternalsPlugin.js:30
    [d2-craft]/[webpack]/lib/ExternalsPlugin.js:30:63

  - Hook.js:154 SyncHook.lazyCompileHook
    [d2-craft]/[cli-service]/[tapable]/lib/Hook.js:154:20

  - Compiler.js:665
    [d2-craft]/[cli-service]/[webpack]/lib/Compiler.js:665:23

  - Hook.js:154 AsyncSeriesHook.lazyCompileHook
    [d2-craft]/[cli-service]/[tapable]/lib/Hook.js:154:20

  - Compiler.js:662 Compiler.compile
    [d2-craft]/[cli-service]/[webpack]/lib/Compiler.js:662:28

  - Compiler.js:328 Compiler.runAsChild
    [d2-craft]/[cli-service]/[webpack]/lib/Compiler.js:328:8

  - compiler.js:75
    [d2-craft]/[html-webpack-plugin]/lib/compiler.js:75:19

  - new Promise

  - compiler.js:74 Object.compileTemplate
    [d2-craft]/[html-webpack-plugin]/lib/compiler.js:74:10

  - index.js:71
    [d2-craft]/[html-webpack-plugin]/index.js:71:42

  - Hook.js:154 AsyncParallelHook.lazyCompileHook
    [d2-craft]/[cli-service]/[tapable]/lib/Hook.js:154:20

  - Compiler.js:669
    [d2-craft]/[cli-service]/[webpack]/lib/Compiler.js:669:20

 DONE  Compiled successfully in 2918ms                                                                                                                                                                3:55:38 PM

Build failed with errors.

———————————————————————————————————————————————

>  NX   ERROR  Running target "vue-core:build" failed

  Failed tasks:

  - vue-core:build

  Hint: run the command with --verbose for more details.

Environment


>  NX  Report complete - copy this into the issue template

  Node : 14.18.1
  OS   : darwin x64
  npm  : 6.14.15

  nx : undefined
  @nrwl/angular : undefined
  @nrwl/cli : 13.2.3
  @nrwl/cypress : 13.2.3
  @nrwl/devkit : 13.2.3
  @nrwl/eslint-plugin-nx : 13.2.3
  @nrwl/express : undefined
  @nrwl/jest : 13.2.3
  @nrwl/linter : 13.2.3
  @nrwl/nest : undefined
  @nrwl/next : undefined
  @nrwl/node : undefined
  @nrwl/nx-cloud : 13.0.1
  @nrwl/react : 13.2.3
  @nrwl/react-native : undefined
  @nrwl/schematics : undefined
  @nrwl/tao : 13.2.3
  @nrwl/web : 13.2.3
  @nrwl/workspace : 13.2.3
  @nrwl/storybook : 13.2.3
  @nrwl/gatsby : undefined
  typescript : 4.4.4
  rxjs : 6.6.7
  ---------------------------------------
  Community plugins:
     @nx-plus/vue: 12.2.0
Aysnine commented 2 years ago

Normal init and not moved still error.

Aysnine commented 2 years ago

Nx13 only support Webpack5. Seem this repo vue-cli4.5 not match.