UNPKG

973 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.getModulePath = void 0;
4var fs_1 = require("fs");
5var path_1 = require("path");
6var JSCONFIG = 'jsconfig.json';
7var TSCONFIG = 'tsconfig.json';
8var getModulePath = function (appDirectory) {
9 // CRA only supports `jsconfig.json` if `tsconfig.json` doesn't exist.
10 var configName = '';
11 if (fs_1.existsSync(path_1.join(appDirectory, TSCONFIG))) {
12 configName = TSCONFIG;
13 }
14 else if (fs_1.existsSync(path_1.join(appDirectory, JSCONFIG))) {
15 configName = JSCONFIG;
16 }
17 try {
18 // eslint-disable-next-line global-require, import/no-dynamic-require, @typescript-eslint/no-var-requires
19 var baseUrl = require(path_1.join(appDirectory, configName)).compilerOptions.baseUrl;
20 return (baseUrl ? [baseUrl] : []);
21 }
22 catch (e) {
23 return [];
24 }
25};
26exports.getModulePath = getModulePath;
27//# sourceMappingURL=getModulePath.js.map
\No newline at end of file