herberttn / bytenode-webpack-plugin

Compile JavaScript into bytecode using bytenode
MIT License
105 stars 27 forks source link

Preloader - Running into Compilation Error #36

Open fras2560 opened 8 months ago

fras2560 commented 8 months ago

I am trying to use the library. I was trying to use your library with the example electron-forge-typescript-webpack as a template.

However, I am running into an issue with the following:

An unhandled rejection has occurred inside Forge:
Error: Compilation errors in the preload: group_0:
  assets by info 2.98 KiB [immutable]
    assets by path *.json 150 bytes
      asset main_window_compiled.783c92c0224cb1109eb5.hot-update.json 44 bytes [emitted] [immutable] [hmr]
      asset preload_compiled.783c92c0224cb1109eb5.hot-update.json 40 bytes [emitted] [immutable] [hmr]
      + 2 assets
    assets by path *.jsc 2.25 KiB
      asset main_window.compiled.783c92c0224cb1109eb5.hot-update.jsc 1.13 KiB [emitted] [immutable] [hmr] (name: main_window.compiled)
      asset preload.compiled.783c92c0224cb1109eb5.hot-update.jsc 1.13 KiB [emitted] [immutable] [hmr] (name: preload.compiled)
    assets by path *.js 598 bytes
      asset main_window.783c92c0224cb1109eb5.hot-update.js 301 bytes [emitted] [immutable] [hmr] (name: main_window)
      asset preload.783c92c0224cb1109eb5.hot-update.js 297 bytes [emitted] [immutable] [hmr] (name: preload)
  asset main_window/preload.js 254 KiB [emitted] (name: main_window)
  asset preload/preload.js 254 KiB [emitted] (name: preload)
  asset main_window.compiled/preload.jsc 227 KiB [emitted] (name: main_window.compiled)
  asset preload.compiled/preload.jsc 227 KiB [emitted] (name: preload.compiled)
  Entrypoint preload 255 KiB = preload/preload.js 254 KiB preload.783c92c0224cb1109eb5.hot-update.js 297 bytes
  Entrypoint main_window 255 KiB = main_window/preload.js 254 KiB main_window.783c92c0224cb1109eb5.hot-update.js 301 bytes
  Entrypoint preload.compiled 228 KiB = preload.compiled/preload.jsc 227 KiB preload.compiled.783c92c0224cb1109eb5.hot-update.jsc 1.13 KiB
  Entrypoint main_window.compiled 228 KiB = main_window.compiled/preload.jsc 227 KiB main_window.compiled.783c92c0224cb1109eb5.hot-update.jsc 1.13 KiB
  runtime modules 106 KiB 50 modules
  cached modules 175 KiB [cached] 32 modules
  javascript modules 312 bytes
    node:assert/strict 39 bytes [built] [1 error]
    node:child_process 39 bytes [built] [1 error]
    node:fs 39 bytes [built] [1 error]
    node:module 39 bytes [built] [1 error]
    node:path 39 bytes [built] [1 error]
    node:vm 39 bytes [built] [1 error]
    node:v8 39 bytes [built] [1 error]
    node:zlib 39 bytes [built] [1 error]

  ERROR in node:assert/strict
  Module build failed: UnhandledSchemeError: Reading from "node:assert/strict" is not handled by plugins (Unhandled scheme).
  Webpack supports "data:" and "file:" URIs by default.
  You may need an additional plugin to handle "node:" URIs.
      at /home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/NormalModule.js:918:25
      at Hook.eval [as callAsync] (eval at create (/home/dallas/Github/mosaic/canvas-desktop/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
      at Hook.CALL_ASYNC_DELEGATE [as _callAsync] (/home/dallas/Github/mosaic/canvas-desktop/node_modules/tapable/lib/Hook.js:18:14)
      at Object.processResource (/home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/NormalModule.js:915:8)
      at processResource (/home/dallas/Github/mosaic/canvas-desktop/node_modules/loader-runner/lib/LoaderRunner.js:220:11)
      at iteratePitchingLoaders (/home/dallas/Github/mosaic/canvas-desktop/node_modules/loader-runner/lib/LoaderRunner.js:171:10)
      at runLoaders (/home/dallas/Github/mosaic/canvas-desktop/node_modules/loader-runner/lib/LoaderRunner.js:398:2)
      at NormalModule._doBuild (/home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/NormalModule.js:905:3)
      at NormalModule.build (/home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/NormalModule.js:1079:15)
      at /home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/Compilation.js:1374:12
      at NormalModule.needBuild (/home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/NormalModule.js:1408:26)
      at Compilation._buildModule (/home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/Compilation.js:1355:10)
      at /home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/util/AsyncQueue.js:305:10
      at Hook.eval [as callAsync] (eval at create (/home/dallas/Github/mosaic/canvas-desktop/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:6:1)
      at AsyncQueue._startProcessing (/home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/util/AsyncQueue.js:295:26)
      at AsyncQueue._ensureProcessing (/home/dallas/Github/mosaic/canvas-desktop/node_modules/webpack/lib/util/AsyncQueue.js:282:12)
   @ ./node_modules/bytenode/lib/index.js 3:15-44
   @ ./src/main/preloaders/preload.loader.js 1:0-19

Is this something to do with my preloader? I cant find much on the error.

herberttn commented 7 months ago

Hello @fras2560

I imagine it has something to do with this part of the message, which is unrelated to this plugin

You may need an additional plugin to handle "node:" URIs.