mirror of
https://github.com/nuxt/nuxt.git
synced 2024-11-23 14:15:13 +00:00
parent
2184df4251
commit
c39cf841a3
@ -1,7 +1,10 @@
|
||||
{
|
||||
"extends": "@nuxt/typescript-edge",
|
||||
"compilerOptions": {
|
||||
"baseUrl": ".",
|
||||
"noImplicitAny": false
|
||||
"noImplicitAny": false,
|
||||
"types": [
|
||||
"@types/node",
|
||||
"@nuxt/vue-app-edge"
|
||||
]
|
||||
}
|
||||
}
|
||||
|
@ -1,6 +1,9 @@
|
||||
{
|
||||
"extends": "@nuxt/typescript-edge",
|
||||
"compilerOptions": {
|
||||
"baseUrl": "."
|
||||
}
|
||||
"types": [
|
||||
"@types/node",
|
||||
"@nuxt/vue-app-edge"
|
||||
]
|
||||
},
|
||||
}
|
||||
|
@ -1,19 +1,3 @@
|
||||
import { readJSON, writeJSON } from 'fs-extra'
|
||||
|
||||
export default {
|
||||
build: true,
|
||||
hooks: {
|
||||
async 'build:done'(pkg) {
|
||||
if (pkg.options.suffix && pkg.options.linkedDependencies) {
|
||||
const tsconfig = await readJSON(pkg.resolvePath('tsconfig.json'))
|
||||
|
||||
tsconfig.compilerOptions.types = tsconfig.compilerOptions.types.map((type) => {
|
||||
const suffix = pkg.options.linkedDependencies.includes(type) ? pkg.options.suffix : ''
|
||||
return type + suffix
|
||||
})
|
||||
|
||||
await writeJSON(pkg.resolvePath('tsconfig.json'), tsconfig, { spaces: 2 })
|
||||
}
|
||||
}
|
||||
}
|
||||
build: true
|
||||
}
|
||||
|
@ -22,7 +22,10 @@ export async function generateTsConfigIfMissing(rootDir) {
|
||||
await writeJSON(tsConfigPath, {
|
||||
extends: configToExtend,
|
||||
compilerOptions: {
|
||||
baseUrl: '.'
|
||||
types: [
|
||||
'@types/node',
|
||||
'@nuxt/vue-app'
|
||||
]
|
||||
}
|
||||
}, { spaces: 2 })
|
||||
consola.info(`Extending ${chalk.bold.blue(`node_modules/${configToExtend}/tsconfig.json`)}`)
|
||||
|
@ -8,7 +8,6 @@
|
||||
"dom"
|
||||
],
|
||||
"esModuleInterop": true,
|
||||
"resolveJsonModule": true,
|
||||
"experimentalDecorators": true,
|
||||
"jsx": "preserve",
|
||||
"sourceMap": true,
|
||||
@ -25,10 +24,6 @@
|
||||
"@/*": [
|
||||
"./*"
|
||||
]
|
||||
},
|
||||
"types": [
|
||||
"@types/node",
|
||||
"@nuxt/vue-app"
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -12,7 +12,7 @@ describe('typescript modern', () => {
|
||||
await new Builder(nuxt, BundleBuilder).build()
|
||||
})
|
||||
|
||||
test('fork-ts-checker-webpack-plugin', () => {
|
||||
test('check types only once', () => {
|
||||
expect(ForkTsCheckerWebpackPlugin).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
|
@ -22,7 +22,10 @@ describe('typescript setup', () => {
|
||||
expect(await readJSON(tsConfigPath)).toEqual({
|
||||
extends: '@nuxt/typescript',
|
||||
compilerOptions: {
|
||||
baseUrl: '.'
|
||||
types: [
|
||||
'@types/node',
|
||||
'@nuxt/vue-app'
|
||||
]
|
||||
}
|
||||
})
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user