@theholocron/vite-config 7.12.0 → 7.13.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/README.md +34 -14
  2. package/package.json +3 -3
package/README.md CHANGED
@@ -12,52 +12,72 @@ pnpm add -D @theholocron/vite-config
12
12
 
13
13
  Pick the preset that matches your project type. All presets accept an `overrides` object that is deep-merged last via `mergeConfig`.
14
14
 
15
- ### Publishable library
15
+ ### React component library
16
+
17
+ Outputs ESM + CJS; externalises `react` and `react-dom`; wires up `@vitejs/plugin-react`; sets `@` as an alias for `src/`. Returns a `Promise` because plugins are loaded dynamically.
18
+
19
+ ```typescript
20
+ import { reactLibrary } from "@theholocron/vite-config/react-library";
21
+
22
+ export default reactLibrary({ name: "my-lib" });
23
+ ```
24
+
25
+ Pass `overrides` to add project-specific config:
26
+
27
+ ```typescript
28
+ import { reactLibrary } from "@theholocron/vite-config/react-library";
29
+ import { storybookTest } from "@storybook/addon-vitest/vitest-plugin";
30
+
31
+ export default reactLibrary({
32
+ name: "my-lib",
33
+ overrides: {
34
+ plugins: [storybookTest()],
35
+ },
36
+ });
37
+ ```
38
+
39
+ ### Publishable library (non-React)
16
40
 
17
41
  Outputs ESM only; externalises `react` and `react-dom` by default. Returns a `Promise` because the plugin is loaded dynamically.
18
42
 
19
- ```javascript
20
- import { defineConfig } from "vite";
43
+ ```typescript
21
44
  import { library } from "@theholocron/vite-config/library";
22
45
 
23
- export default defineConfig(await library({ entry: "src/index.ts", name: "MyLib" }));
46
+ export default library({ entry: "src/index.ts", name: "MyLib" });
24
47
  ```
25
48
 
26
49
  ### React single-page application
27
50
 
28
51
  Requires `@vitejs/plugin-react` as a peer dependency. Returns a `Promise` because the plugin is loaded dynamically.
29
52
 
30
- ```javascript
31
- import { defineConfig } from "vite";
53
+ ```typescript
32
54
  import { reactApp } from "@theholocron/vite-config/react-app";
33
55
 
34
- export default defineConfig(await reactApp());
56
+ export default reactApp();
35
57
  ```
36
58
 
37
59
  Pass `vite-tsconfig-paths` via `overrides.plugins` to enable tsconfig path aliases:
38
60
 
39
- ```javascript
40
- import { defineConfig } from "vite";
61
+ ```typescript
41
62
  import tsconfigPaths from "vite-tsconfig-paths";
42
63
  import { reactApp } from "@theholocron/vite-config/react-app";
43
64
 
44
- export default defineConfig(await reactApp({ plugins: [tsconfigPaths()] }));
65
+ export default reactApp({ plugins: [tsconfigPaths()] });
45
66
  ```
46
67
 
47
68
  ### Node.js CLI tool or server app
48
69
 
49
70
  Targets Node 22; outputs a single ESM bundle with no browser polyfills. Returns a `Promise` because the plugin is loaded dynamically.
50
71
 
51
- ```javascript
52
- import { defineConfig } from "vite";
72
+ ```typescript
53
73
  import { nodeApp } from "@theholocron/vite-config/node-app";
54
74
 
55
- export default defineConfig(await nodeApp({ entry: "src/index.ts" }));
75
+ export default nodeApp({ entry: "src/index.ts" });
56
76
  ```
57
77
 
58
78
  ## Codecov bundle analysis
59
79
 
60
- All three presets automatically include [`@codecov/vite-plugin`](https://www.npmjs.com/package/@codecov/vite-plugin) when `@codecov/vite-plugin` is installed and `CODECOV_TOKEN` is set in the environment. No extra configuration in `vite.config.ts` is needed — bundle stats are uploaded to Codecov on every build.
80
+ All presets automatically include [`@codecov/vite-plugin`](https://www.npmjs.com/package/@codecov/vite-plugin) when `@codecov/vite-plugin` is installed and `CODECOV_TOKEN` is set in the environment. No extra configuration in `vite.config.ts` is needed — bundle stats are uploaded to Codecov on every build.
61
81
 
62
82
  Install the peer dependency:
63
83
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/vite-config",
3
- "version": "7.12.0",
3
+ "version": "7.13.1",
4
4
  "description": "Vite configuration presets for libraries, React apps, and Node tools within the Galaxy.",
5
5
  "homepage": "https://github.com/theholocron/configs/tree/main/packages/vite-config#readme",
6
6
  "bugs": "https://github.com/theholocron/configs/issues",
@@ -26,8 +26,8 @@
26
26
  "@vitest/coverage-v8": "^4.1.10",
27
27
  "vite": "^8.2.0",
28
28
  "@codecov/vite-plugin": "^2.0.0",
29
- "@theholocron/tsconfig": "7.12.0",
30
- "@theholocron/vitest-config": "7.12.0"
29
+ "@theholocron/tsconfig": "7.13.1",
30
+ "@theholocron/vitest-config": "7.13.1"
31
31
  },
32
32
  "exports": {
33
33
  ".": {