Files
flights_web_raw/node_modules/@angular-builders/custom-webpack/dist/utils.js
T

30 lines
1.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.tsNodeRegister = void 0;
/**
* check for TS node registration
* @param file: file name or file directory are allowed
* @todo tsNodeRegistration: require ts-node if file extension is TypeScript
*/
function tsNodeRegister(file = '', tsConfig) {
if (file && file.endsWith('.ts')) {
// Register TS compiler lazily
require('ts-node').register({
project: tsConfig,
compilerOptions: {
module: 'CommonJS',
types: [
'node', // NOTE: `node` is added because users scripts can also use pure node's packages as webpack or others
],
},
});
// Register paths in tsConfig
const tsconfigPaths = require('tsconfig-paths');
const { absoluteBaseUrl: baseUrl, paths } = tsconfigPaths.loadConfig(tsConfig);
if (baseUrl && paths) {
tsconfigPaths.register({ baseUrl, paths });
}
}
}
exports.tsNodeRegister = tsNodeRegister;
//# sourceMappingURL=utils.js.map