Skip to content

Commit

Permalink
Fix require function name in README.md
Browse files Browse the repository at this point in the history
The variable holding the function returned by `createRequire()` is named `req` but the `require` function is being used below, so `require` is undefined here. This fixes that by ensuring that both variable names are the same.

PR-URL: #64
Credit: @RaisinTen
Close: #64
Reviewed-by: @isaacs
  • Loading branch information
RaisinTen authored and isaacs committed Jun 6, 2024
1 parent 3ad79d6 commit 2d0813d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ Consider this contrived example:
// import the class from ESM
import { SomeClass } from 'module-built-by-tshy'
import { createRequire } from 'node:module'
const req = createRequire(import.meta.url)
const require = createRequire(import.meta.url)

// create an object using the commonjs version
function getObject() {
Expand Down

0 comments on commit 2d0813d

Please sign in to comment.