rhysd / electron-about-window

'About This App' mini-window for Electron apps
https://www.npmjs.com/package/about-window
MIT License
409 stars 46 forks source link

allow pass in package.json directly #90

Open noob9527 opened 6 months ago

noob9527 commented 6 months ago

the lib use require and module.paths API to resolve the package.json file. these API call cannot be transformed into equivalent API call in es module, which make it incompatible with some build systems(vite). it throw the following exception

Uncaught Exception:
TypeError: module2.paths is not iterable at detectPackageJson

it's because loadPackageJson fail.

Could not dynamically require ".../package.json". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.

Unfortunately, somehow configure dynamicRequireTargets as the error hint doesn't solve the problem, maybe it's because the pre-bundle mechanism in vite. I think allow the user to pass in package.json directly is the quickest way to solve the problem.