braidnetworks / dynohot

Hot module reloading for nodejs
ISC License
90 stars 3 forks source link

`Firebase Command Line Tools` related error using `Node.js` version `22.x` #9

Closed kireerik closed 5 months ago

kireerik commented 5 months ago

I am getting the following error with the above Node.js version:

hot:module?url=file%3A%2F%2F%2F...%2Fnode_modules%2F.pnpm%2Ffirebase-tools%4013.12.0_encoding%400.1.13%2Fnode_modules%2Ffirebase-tools%2Flib%2Findex.js:1
import * as namespace from "file:///.../node_modules/.pnpm/firebase-tools@13.12.0_encoding@0.1.13/node_modules/firebase-tools/lib/index.js" assert {};

                                           ^^^^^^

SyntaxError: Unexpected identifier 'assert'
    at compileSourceTextModule (node:internal/modules/esm/utils:337:16)
    at ModuleLoader.moduleStrategy (node:internal/modules/esm/translators:164:18)
    at callTranslator (node:internal/modules/esm/loader:429:14)
    at ModuleLoader.moduleProvider (node:internal/modules/esm/loader:435:30) {
  __stack: [ CallSite {}, CallSite {}, CallSite {}, CallSite {} ]
}

Node.js v22.3.0
 ELIFECYCLE  Command failed with exit code 1.

  Without using dynohot I don't get the above error(, but this other known one:

).

  Using Node.js version 21.x there is no error at all and features work as expected.

laverdet commented 5 months ago

Hi there it would help if you posted a minimal reproduction case. This would include: source files, package.json contents, and the command-line arguments used to invoke nodejs.

kireerik commented 5 months ago

Sure. You can use this one: https://github.com/kireerik/refo (This one uses Superstatic directly and has the same error.)

pnpm dev

laverdet commented 5 months ago

Ah ok sorry I fixed this a long time ago in our local repository but never pushed it out here, so I was confused. Can you try v1.2.0 and see if it works?

kireerik commented 5 months ago

With version 1.2.0 I am getting the following error (even with Node.js version 21.x):


file:///../refo/source/firebase.json.js:79
        import.meta.hot.prune(remove('firebase.json'))
                        ^

TypeError: Cannot read properties of undefined (reading 'prune')
    at file:///../refo/source/firebase.json.js:79:18
    at ModuleJob.run (node:internal/modules/esm/module_job:262:25)
    at async onImport.tracePromise.__proto__ (node:internal/modules/esm/loader:485:26)
    at async file:///../refo/index/index.js:5:1 {
  __stack: [ CallSite {}, CallSite {}, CallSite {}, CallSite {} ]
}

Node.js v22.4.0
 ELIFECYCLE  Command failed with exit code 1.
 ELIFECYCLE  Command failed with exit code 1.
 ```
kireerik commented 5 months ago

No, it works as expected after updating the usage (https://github.com/kireerik/refo/commit/3ac49d34a6a1554a0fdb0394af9a559e89928e04). Thank you!