Skip to content

Commit

Permalink
deps: update deps
Browse files Browse the repository at this point in the history
changed back to old way of building types
  • Loading branch information
AlansCodeLog committed Jul 21, 2023
1 parent 4a30d3d commit 2eb0543
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,6 @@
"typedoc": "^0.24.8",
"typescript": "^5.1.6",
"vite": "^4.4.4",
"vite-plugin-dts": "^3.3.1",
"vite-plugin-externalize-deps": "^0.7.0",
"vite-tsconfig-paths": "^4.2.0",
"vitest": "^0.33.0"
Expand Down
16 changes: 4 additions & 12 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,15 @@ import { run } from "@alanscodelog/utils/node"
import glob from "fast-glob"
import path from "path"
import type { PluginOption } from "vite"
import dts from "vite-plugin-dts"
import { externalizeDeps } from "vite-plugin-externalize-deps"
import tsconfigPaths from "vite-tsconfig-paths"
import { defineConfig } from "vitest/config"


const typesPlugin = ({ fixOnly }: { fixOnly: boolean }): PluginOption => ({
const typesPlugin = (): PluginOption => ({
name: "typesPlugin",
// eslint-disable-next-line no-console
writeBundle: async () => run(`npm run build:types${fixOnly ? ":fix" : ""}`).promise.catch(e => console.log(e)).then(() => undefined),
writeBundle: async () => run(`npm run build:types`).promise.catch(e => console.log(e)).then(() => undefined),
})

// https://vitejs.dev/config/
Expand All @@ -21,15 +20,8 @@ export default async ({ mode }: { mode: string }) => defineConfig({
externalizeDeps(),
// even if we don't use aliases, this is needed to get imports based on baseUrl working
tsconfigPaths(),
// generates types for ts/vue files
// if only using ts, can be removed and build:types script used instead
dts({
entryRoot: "src",
tsconfigPath: "./tsconfig.types.json",
}),
// fixes alias and baseUrl imports in the generated types
// cannot be removed because dts is not compatible with tsconfigPaths
typesPlugin({ fixOnly: true }),
// runs build:types script which takes care of generating types and fixing type aliases and baseUrl imports
typesPlugin(),
],
build: {
outDir: "dist",
Expand Down

0 comments on commit 2eb0543

Please sign in to comment.