CSFrequency / react-firebase-hooks

React Hooks for Firebase.
Apache License 2.0
3.58k stars 304 forks source link

util/index.ts build error due to "built-in module" #258

Open joshuahhh opened 2 years ago

joshuahhh commented 2 years ago

Hello! When I check out this repo (at edab3f3) and run yarn, it installs dependencies and then starts a build.

The build fails at this point:

util/index.ts → util/dist/index.cjs.js, util/dist/index.esm.js...
(!) Plugin node-resolve: preferring built-in module 'util/index.ts' over local alternative at '/Users/joshuah/Dropbox/docs/coding/react-firebase-hooks/util/index.ts', pass 'preferBuiltins: false' to disable this behavior or 'preferBuiltins: true' to disable this warning
[!] Error: Entry module cannot be external (util/index.ts).
Error: Entry module cannot be external (util/index.ts).
    at error (/Users/joshuah/Dropbox/docs/coding/react-firebase-hooks/node_modules/rollup/dist/shared/rollup.js:198:30)
    at ModuleLoader.loadEntryModule (/Users/joshuah/Dropbox/docs/coding/react-firebase-hooks/node_modules/rollup/dist/shared/rollup.js:22489:20)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)
    at async Promise.all (index 0)

I'm not well-versed in rollup, but changing rollup.config.js to read (in part)

  resolveModule({
    preferBuiltins: false,
  }),

seems to fix this.

Does anyone know why might the build might be failing in my environment? Would adding preferBuiltins: false be a useful change in general?

Thanks for any help!