Skip to content

Commit b27965d

Browse files
committed
refactor: replace __dirname with import.meta.dirname for modern esm compatibility
1 parent d457a58 commit b27965d

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

scripts/base.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { fileURLToPath } from 'url'
33
import { spawn } from 'child_process'
44
import { rimraf } from 'rimraf'
55

6-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
6+
const dirname = import.meta.dirname
77
const isProd = process.env.NODE_ENV === 'production'
88
const isDev = process.env.NODE_ENV === 'local'
99
let nodeProcess = null
@@ -16,16 +16,16 @@ if (isDev) {
1616

1717
/** @type {import('esbuild').BuildOptions} */
1818
export const config = {
19-
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
20-
outfile: path.resolve(__dirname, '../build/index.js'),
19+
entryPoints: [path.resolve(dirname, '../src/index.ts')],
20+
outfile: path.resolve(dirname, '../build/index.js'),
2121
format: 'esm',
2222
bundle: true,
2323
sourcemap: isDev,
2424
minify: isProd,
2525
platform: 'node',
2626
external: ['dotenv', 'timers/promises', '@modelcontextprotocol/sdk'],
2727
alias: {
28-
'@': path.resolve(__dirname, '../src'),
28+
'@': path.resolve(dirname, '../src'),
2929
},
3030
plugins: [
3131
{

0 commit comments

Comments
 (0)