Skip to content

Commit

Permalink
perf(prepare): normalise compiler options once
Browse files Browse the repository at this point in the history
  • Loading branch information
danielroe committed Jun 22, 2023
1 parent e9c9b49 commit b86fad5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/utils/prepare.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,8 @@ export const writeTypes = async (nuxt: Nuxt) => {
],
})

tsConfig.compilerOptions = tsConfig.compilerOptions || {}

const aliases: Record<string, string> = {
...nuxt.options.alias,
'#build': nuxt.options.buildDir,
Expand All @@ -69,7 +71,6 @@ export const writeTypes = async (nuxt: Nuxt) => {
const stats = await fsp
.stat(resolve(basePath, relativePath))
.catch(() => null /* file does not exist */)
tsConfig.compilerOptions = tsConfig.compilerOptions || {}
if (stats?.isDirectory()) {
tsConfig.compilerOptions.paths[alias] = [relativePath]
tsConfig.compilerOptions.paths[`${alias}/*`] = [`${relativePath}/*`]
Expand Down

0 comments on commit b86fad5

Please sign in to comment.