angular-esbuild-example icon indicating copy to clipboard operation
angular-esbuild-example copied to clipboard

Cannot read property 'build' of undefined

Open draylegend opened this issue 4 years ago • 0 comments

I'm using the nrwl/nx based workspace with the standalone config, so the angular.json looks like this:

angular.json

{
  "version": 2,
  "projects": {
    "app-1": "apps/app-1",
    "api": "apps/api",
    "shared": "libs/shared"
  }
}

After I run the npx ngc-esbuild I get the following error:

X [ERROR] [plugin angularAssetsResolver] Cannot read property 'build' of undefined

    C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\bin\run-esbuild.js:119:71:
      119 │       this.builderOptions = angularSettings.projects[project].architect[mode].options;
          ╵                                                                        ^

    at NgEsbuild.getBuilderOptions (C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\bin\run-esbuild.js:119:72)
    at async setup (C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\bin\plugin\esbuild-assets-resolver.js:11:23)
    at async handlePlugins (C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\node_modules\esbuild\lib\main.js:856:11)

(node:14972) UnhandledPromiseRejectionWarning: Error: Build failed with 1 error:
C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\bin\run-esbuild.js:119:71: ERROR: [plugin: angularAssetsResolver] Cannot read property 'build' of undefined
    at failureErrorWithLog (C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\node_modules\esbuild\lib\main.js:1557:15)
    at C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\node_modules\esbuild\lib\main.js:1102:18
    at C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\node_modules\esbuild\lib\main.js:1097:9
    at C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\node_modules\esbuild\lib\main.js:637:9
    at handleIncomingPacket (C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\node_modules\esbuild\lib\main.js:734:9)
    at Socket.readFromStdout (C:\Users\admin\AppData\Roaming\npm-cache\_npx\14972\node_modules\ngc-esbuild\node_modules\esbuild\lib\main.js:604:7)
    at Socket.emit (events.js:400:28)
    at addChunk (internal/streams/readable.js:290:12)
    at readableAddChunk (internal/streams/readable.js:265:9)
    at Socket.Readable.push (internal/streams/readable.js:204:10)
(Use `node --trace-warnings ...` to show where the warning was created)
(node:14972) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a cat
ch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 1)
(node:14972) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.

Is there a chance to get it to work with nx' standalone apps and libs?

draylegend avatar Jan 23 '22 14:01 draylegend