Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
index: use Node's CommonJS JSON loader
- Node natively supports loading JSON via `require()` since 2011, which is a cleaner and easier way to load JSON: https://nodejs.org/en/blog/release/v0.5.2 - Node's `require()` safely performs regular JSON decode whenever it detects a ".json" file extension, which is what our "detectable.json" filename is using. - The `createRequire()` API is only necessary because arRPC is not a CommonJS project. Using `createRequire()` is a completely normal, supported interoperability feature of Node, and is documented here: https://nodejs.org/api/module.html#modulecreaterequirefilename - This change was done to help downstream projects based on CommonJS or ASAR bundles. Without this change, arRPC will not work in certain downstream apps (depending on their bundling methods).
- Loading branch information