File tree Expand file tree Collapse file tree 1 file changed +3
-3
lines changed
Expand file tree Collapse file tree 1 file changed +3
-3
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ import fs from 'node:fs';
55
66import type { TsConfigJson } from 'get-tsconfig' ;
77import type { TransformPluginContext } from 'rollup' ;
8- import { fileURLToPath } from 'node:url' ;
8+ import { fileURLToPath , pathToFileURL } from 'node:url' ;
99
1010const cache = new Map < string , TsConfigJson . CompilerOptions > ( ) ;
1111
@@ -61,8 +61,8 @@ export function getOptions(
6161
6262export function checkIsLegacyTypeScript ( ) {
6363 try {
64- // @ts -expect-error -- It's required to using 'import.mtea .url' but i don't want to change the tsconfig.
65- const tsPath = resolve ( 'typescript/package.json' , import . meta. url ) ;
64+ // @ts -expect-error -- It's required to using 'import.meta .url' but i don't want to change the tsconfig.
65+ const tsPath = resolve ( 'typescript/package.json' , typeof __filename === 'string' ? pathToFileURL ( __filename ) : import . meta. url ) ;
6666 const { version } = JSON . parse ( fs . readFileSync ( fileURLToPath ( tsPath ) , 'utf-8' ) ) ;
6767 const [ major ] = version . split ( '.' ) ;
6868 // typescript 5+ enable experimentalDecorators by default so we think it's not legacy
You can’t perform that action at this time.
0 commit comments