gx
chenyc
2025-02-12 ea42ff3ebee1eeb3fb29423aa848a249441db81c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
 
const { Module } = require('module');
const m = new Module('', null);
const { quiet, typescriptLookupPath } = JSON.parse(process.env.__NCC_OPTS || '{}');
m.paths = Module._nodeModulePaths(process.env.TYPESCRIPT_LOOKUP_PATH || typescriptLookupPath || (process.cwd() + '/'));
let typescript;
try {
  typescript = m.require('typescript');
  if (!quiet) console.log("ncc: Using typescript@" + typescript.version + " (local user-provided)");
}
catch (e) {
  typescript = require('typescript');
  if (!quiet) console.log("ncc: Using typescript@" + typescript.version + " (ncc built-in)");
}
module.exports = typescript;