Skip to content

Commit 39a6feb

Browse files
author
Mike Valeriano
committed
chore: adjust vite config
1 parent cb14ad0 commit 39a6feb

3 files changed

Lines changed: 87 additions & 11 deletions

File tree

package-lock.json

Lines changed: 75 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,8 @@
3838
"rollup-plugin-node-externals": "^8.0.1",
3939
"tsx": "^4.20.3",
4040
"typescript": "^5.8.3",
41-
"vite": "^6.3.5"
41+
"vite": "^6.3.5",
42+
"vite-tsconfig-paths": "^5.1.4"
4243
},
4344
"dependencies": {
4445
"@mkvlrn/result": "^1.1.4"

vite.config.ts

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,29 @@
11
import { glob } from "node:fs/promises";
2-
import { fileURLToPath } from "node:url";
32
import { nodeExternals } from "rollup-plugin-node-externals";
43
import { defineConfig } from "vite";
4+
import tsconfigPaths from "vite-tsconfig-paths";
55

6+
// all files except test files
67
const entryFiles: string[] = [];
78
for await (const file of glob("src/**/*.ts")) {
8-
// no need to bundle test files
99
if (!(file.endsWith(".test.ts") || file.endsWith(".spec.ts"))) {
1010
entryFiles.push(file);
1111
}
1212
}
1313

1414
export default defineConfig({
15-
resolve: {
16-
alias: {
17-
"~": fileURLToPath(new URL("./src", import.meta.url)),
18-
},
19-
},
20-
2115
plugins: [
16+
// externalize node builtins and configure dependencies to be externalized (or not)
2217
nodeExternals({
23-
// packages to be set as internal
18+
// externalize dependencies in package.json
19+
deps: true,
20+
// devDependencies in package.json
21+
devDeps: false,
22+
// dependencies to be made bundled
2423
exclude: ["@mkvlrn/result"],
2524
}),
25+
// resolve tsconfig path aliases
26+
tsconfigPaths(),
2627
],
2728

2829
build: {

0 commit comments

Comments
 (0)