iTwin / itwinjs-core

Monorepo for iTwin.js Library
https://www.itwinjs.org
MIT License
615 stars 210 forks source link

backend-webpack-tools fails on an itwin.js electron app without node-report installed #4309

Closed MichaelBelousov closed 2 years ago

MichaelBelousov commented 2 years ago

Describe the bug run backend-webpack-tools build -s lib/backend/main.js -o backend-bundle on an electron iTwin.js desktop app

To Reproduce Create an iTwin.js desktop viewer electron app, without node-report as a dependency and try to build it with backend-webpack-tools.

Steps to reproduce the behavior:

CI=1 pnpm exec backend-webpack-tools build -s lib/backend/main.js -o backend-bundle/
 BACKEND  Starting build...
  (node:3444659) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
  (Use `node --trace-deprecation ...` to show where the warning was created)

  Treating warnings as errors because process.env.CI is set.
  Most CI servers set it automatically.

 BACKEND  Failed to compile   (in 8,701 ms)

  [object Object]

 BACKEND  Failed to compile   (in 8,701 ms)
  [PrettyLoggingError: [object Object]]

Expected behavior It builds.

Additional context

It builds with a warning if not in CI mode

$ pnpm exec backend-webpack-tools build -s lib/backend/main.js -o backend-bundle/
 BACKEND  Starting build...
  (node:3442161) [DEP_WEBPACK_MODULE_ISSUER] DeprecationWarning: Module.issuer: Use new ModuleGraph API
  (Use `node --trace-deprecation ...` to show where the warning was created)
  {
    "message": "Can't copy external package \"node-report\" - it is not installed.\nTo fix this, either npm install node-report or wrap the import in a try/catch.",
    "stack": "Error: Can't copy external package \"node-report\" - it is not installed.\nTo fix this, either npm install node-report or wrap the import in a try/catch.\n    at CopyExternalsPlugin.handleModule (/redacted/node_modules/.pnpm/@itwin+core-webpack-tools@3.3.4_webpack@5.74.0/node_modules/@itwin/core-webpack-tools/lib/plugins/CopyExternalsPlugin.js:47:39)\n    at /redacted/node_modules/.pnpm/@itwin+core-webpack-tools@3.3.4_webpack@5.74.0/node_modules/@itwin/core-webpack-tools/lib/plugins/CopyExternalsPlugin.js:25:46\n    at Hook.eval [as call] (eval at create (/redacted/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)\n    at /redacted/node_modules/.pnpm/webpack@5.74.0/node_modules/webpack/lib/Compilation.js:1369:28\n    at ExternalModule.needBuild (/redacted/node_modules/.pnpm/webpack@5.74.0/node_modules/webpack/lib/ExternalModule.js:439:10)\n    at Compilation._buildModule (/redacted/node_modules/.pnpm/webpack@5.74.0/node_modules/webpack/lib/Compilation.js:1352:10)\n    at /redacted/node_modules/.pnpm/webpack@5.74.0/node_modules/webpack/lib/util/AsyncQueue.js:303:10\n    at Hook.eval [as callAsync] (eval at create (/redacted/node_modules/.pnpm/tapable@2.2.1/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)\n    at AsyncQueue._startProcessing (/redacted/node_modules/.pnpm/webpack@5.74.0/node_modules/webpack/lib/util/AsyncQueue.js:293:26)\n    at AsyncQueue._ensureProcessing (/redacted/node_modules/.pnpm/webpack@5.74.0/node_modules/webpack/lib/util/AsyncQueue.js:280:12)"
  }

  Search for the keywords to learn more about eslint warnings.
  To ignore an eslint warning, add // eslint-disable-next-line to the line before.

 BACKEND  Compiled with warnings   (in 8,813 ms)
aruniverse commented 2 years ago

@MichaelBelousov heads up, https://github.com/iTwin/itwinjs-core/issues/4091