File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -552,20 +552,11 @@ export function catalogMigration(
552552const pipe = ( ...functions : Array < Function > ) => ( args : any ) : any =>
553553 functions . reduce ( ( arg , fn ) => fn ( arg ) , args )
554554
555- // copied from @EndemolShineGroup /cosmiconfig-typescript-loader
556- // to support sync operations
557- // if this PR gets merged and published, this piece of code can be thrown away
558- // https://github.com/EndemolShineGroup/cosmiconfig-typescript-loader/pull/132
555+ /** Typescript loader using just typescript API and eval(), instead of using ts-node/register which is slower */
559556function TypeScriptLoader ( filePath : string ) {
560- try {
561- require ( "ts-node/register" )
562- const result = require ( filePath )
563-
564- return get ( result , "default" , result )
565- } catch ( error ) {
566- // Replace with logger class OR throw a more specific error
567- throw require ( "@endemolshinegroup/cosmiconfig-typescript-loader/dist/Errors/TypeScriptCompileError" ) . fromError (
568- error
569- )
570- }
557+ const tsc = require ( "typescript" )
558+ const fileContent = fs . readFileSync ( filePath , "utf-8" )
559+ const { outputText } = tsc . transpileModule ( fileContent , { compilerOptions : { module : tsc . ModuleKind . CommonJS } } ) ;
560+ const configFileParsed = eval ( outputText )
561+ return configFileParsed
571562}
You can’t perform that action at this time.
0 commit comments