Skip to content

Commit

Permalink
fix: use isomorphic __dirname
Browse files Browse the repository at this point in the history
  • Loading branch information
fi3ework committed Aug 26, 2022
1 parent d39df59 commit 4f349cc
Showing 1 changed file with 4 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@ import path, { dirname } from 'path'
import { fileURLToPath } from 'url'
const _require = createRequire(import.meta.url)

const __filename = fileURLToPath(import.meta.url)
const __dirname = dirname(__filename)
// isomorphic __dirname https://antfu.me/posts/isomorphic-dirname
const _filename = fileURLToPath(import.meta.url)
const _dirname = dirname(_filename)

const proxyPath = _require.resolve('vue-tsc/out/proxy')

Expand Down Expand Up @@ -43,7 +44,7 @@ const textToReplace: { target: string; replacement: string }[] = [

export function prepareVueTsc() {
// 1. copy typescript to folder
const targetTsDir = path.resolve(__dirname, 'typescript-vue-tsc')
const targetTsDir = path.resolve(_dirname, 'typescript-vue-tsc')
const vueTscFlagFile = path.resolve(targetTsDir, 'vue-tsc-resolve-path')

let shouldPrepare = true
Expand Down

0 comments on commit 4f349cc

Please sign in to comment.