fix: (regression 0.26.1) base plugins not loaded

Massimo Melina committed Sep 3, 2022 at 21:56 UTC 41722353f74a96ce5d3b362d031e4c80ede863c1
1 file changed +4 -5
src/const.ts
+4 -5
@@ -4,7 +4,7 @@ import minimist from 'minimist'
4 import * as fs from 'fs'
5 import { homedir } from 'os'
6 import { mkdirSync } from 'fs'
7 -import { join, resolve } from 'path'
7 +import { basename, dirname, join } from 'path'
8
9 export const argv = minimist(process.argv.slice(2))
10 export const DEV = process.env.DEV || argv.dev ? 'DEV' : ''
@@ -32,8 +32,8 @@ export const FORBIDDEN = 403
32 export const UNAUTHORIZED = 401
33
34 export const IS_WINDOWS = process.platform === 'win32'
35 -
36 -export const APP_PATH = resolve(__dirname + '/..')
35 +const IS_BINARY = !basename(process.argv0).includes('node') // this won't be node if pkg was used
36 +export const APP_PATH = dirname(IS_BINARY ? process.argv0 : __dirname)
37
38 // we want this to be the first stuff to be printed, then we print it in this module, that is executed at the beginning
39 if (DEV) console.clear()
@@ -54,5 +54,4 @@ else if (!process.argv0.endsWith('.exe')) { // still considering whether to use
54 }
55 process.chdir(dir)
56 }
57 -console.log('cwd', process.cwd())
58 -
57 +console.log('cwd', process.cwd())
\ No newline at end of file