Skip to content

Commit

Permalink
fix: dynamic require of "tty" is not supported
Browse files Browse the repository at this point in the history
  • Loading branch information
xsjcTony committed Mar 23, 2024
1 parent d59567d commit f29ff3a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions cjs-shim.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
import { createRequire } from 'node:module'
import { dirname } from 'node:path'
import { fileURLToPath } from 'node:url'


globalThis.require = createRequire(import.meta.url)
globalThis.__filename = fileURLToPath(import.meta.url)
globalThis.__dirname = dirname(__filename)
1 change: 1 addition & 0 deletions tsup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ export default defineConfig({
entry: [
'src/index.ts',
],
inject: ['cjs-shim.ts'],
external: ['@next/eslint-plugin-next'],
shims: true,
format: ['cjs', 'esm'],
Expand Down

0 comments on commit f29ff3a

Please sign in to comment.