Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
25 lines (21 sloc) 612 Bytes
import { resolve } from 'path'
import { register } from 'ts-node'
import { Hooks } from '@nuxt/types/cli'
const hooks: Hooks = {
'run:before' ({ argv, rootDir }) {
const customPath = argv.find((_arg, index) => index > 0 && argv[index - 1] === '--tsconfig')
const tsConfigPath = resolve(customPath || rootDir, customPath && customPath.endsWith('.json') ? '' : 'tsconfig.json')
register({
project: tsConfigPath,
compilerOptions: {
module: 'commonjs'
}
})
},
config (config) {
config.extensions = [...(config.extensions || []), 'ts']
}
}
export {
hooks
}
You can’t perform that action at this time.