Skip to content

Commit 839dac3

Browse files
committed
refactor: replace __dirname with import.meta.dirname for esm compatibility
1 parent 2978427 commit 839dac3

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
@@ -5,7 +5,7 @@ import { spawn } from 'child_process'
55
import { rimraf } from 'rimraf'
66
import kill from 'tree-kill'
77

8-
const __dirname = path.dirname(fileURLToPath(import.meta.url))
8+
const dirname = import.meta.dirname
99
const isProd = process.env.NODE_ENV === 'production'
1010
const isDev = process.env.NODE_ENV === 'local'
1111
let inspectorProcess = null
@@ -14,8 +14,8 @@ let autoOpenBrowser = true
1414

1515
/** @type {import('esbuild').BuildOptions} */
1616
export const config = {
17-
entryPoints: [path.resolve(__dirname, '../src/index.ts')],
18-
outfile: path.resolve(__dirname, '../build/index.js'),
17+
entryPoints: [path.resolve(dirname, '../src/index.ts')],
18+
outfile: path.resolve(dirname, '../build/index.js'),
1919
format: 'esm',
2020
bundle: true,
2121
sourcemap: isDev,
@@ -32,7 +32,7 @@ export const config = {
3232
'html-to-md',
3333
],
3434
alias: {
35-
'@': path.resolve(__dirname, '../src'),
35+
'@': path.resolve(dirname, '../src'),
3636
},
3737
plugins: [
3838
{

0 commit comments

Comments
 (0)