UNPKG

@nuxt/typescript-runtime

Version:

Nuxt.js TypeScript Runtime support

23 lines (22 loc) 787 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.hooks = void 0; const path_1 = require("path"); const ts_node_1 = require("ts-node"); const hooks = { 'run:before'({ argv, rootDir }) { const customPath = argv.find((_arg, index) => index > 0 && argv[index - 1] === '--tsconfig'); const tsConfigPath = (0, path_1.resolve)(customPath || rootDir, customPath && customPath.endsWith('.json') ? '' : 'tsconfig.json'); (0, ts_node_1.register)({ project: tsConfigPath, compilerOptions: { module: 'commonjs' }, transpileOnly: true }); }, config(config) { config.extensions = [...(config.extensions || []), 'ts']; } }; exports.hooks = hooks;