UNPKG

777 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.hooks = void 0;
4const path_1 = require("path");
5const ts_node_1 = require("ts-node");
6const hooks = {
7 'run:before'({ argv, rootDir }) {
8 const customPath = argv.find((_arg, index) => index > 0 && argv[index - 1] === '--tsconfig');
9 const tsConfigPath = path_1.resolve(customPath || rootDir, customPath && customPath.endsWith('.json') ? '' : 'tsconfig.json');
10 ts_node_1.register({
11 project: tsConfigPath,
12 compilerOptions: {
13 module: 'commonjs'
14 },
15 transpileOnly: true
16 });
17 },
18 config(config) {
19 config.extensions = [...(config.extensions || []), 'ts'];
20 }
21};
22exports.hooks = hooks;