bojuvue 0.4.2 → 0.4.3

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.
package/README.md CHANGED
@@ -60,6 +60,31 @@ export default {
60
60
  The same stylesheet covers every component from both import paths — one import is
61
61
  enough regardless of which paths you use.
62
62
 
63
+ ### VitePress SSR builds
64
+
65
+ If your site does a production SSR build (VitePress's default `vitepress build`), add
66
+ this package's Vite plugin to your own `.vitepress/config.mts` so the build doesn't
67
+ break:
68
+
69
+ ```ts
70
+ // .vitepress/config.mts
71
+ import { defineConfig } from 'vitepress'
72
+ import { bojuvue } from 'bojuvue/vite'
73
+
74
+ export default defineConfig({
75
+ vite: { plugins: [bojuvue()] },
76
+ })
77
+ ```
78
+
79
+ Without it, importing anything from `bojuvue/vitepress` can break your SSR build,
80
+ because Vite externalizes `node_modules` dependencies by default during an SSR build —
81
+ which means this package's own internal `vitepress/theme` import gets resolved by
82
+ Node's raw module loader instead of Vite's, and that fails. The plugin tells Vite to
83
+ bundle this package through its own resolver instead, the same way your site's own
84
+ theme code already resolves an identical import successfully. See
85
+ [#70](https://github.com/ScottKirvan/BojuVue/issues/70) for the full failure mode.
86
+ No component API changes — this is the only thing that changes.
87
+
63
88
  Then in any .md page, no import needed:
64
89
 
65
90
  ```md
@@ -0,0 +1,2 @@
1
+ import { Plugin } from 'vite';
2
+ export declare function bojuvue(): Plugin;
@@ -0,0 +1 @@
1
+ export {};
package/dist/vite.cjs ADDED
@@ -0,0 +1 @@
1
+ Object.defineProperty(exports,Symbol.toStringTag,{value:`Module`});function e(){return{name:`bojuvue`,config:()=>({ssr:{noExternal:[`bojuvue`]}})}}exports.bojuvue=e;
package/dist/vite.js ADDED
@@ -0,0 +1,9 @@
1
+ //#region src/vite-plugin.ts
2
+ function e() {
3
+ return {
4
+ name: "bojuvue",
5
+ config: () => ({ ssr: { noExternal: ["bojuvue"] } })
6
+ };
7
+ }
8
+ //#endregion
9
+ export { e as bojuvue };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bojuvue",
3
- "version": "0.4.2",
3
+ "version": "0.4.3",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vue 3 components including a download button that serves each visitor the right build for their OS. Works in any Vue 3 app; VitePress-aware variants included.",
@@ -27,11 +27,16 @@
27
27
  "types": "./dist/vitepress.d.ts",
28
28
  "import": "./dist/vitepress.js"
29
29
  },
30
+ "./vite": {
31
+ "types": "./dist/vite-plugin.d.ts",
32
+ "import": "./dist/vite.js",
33
+ "require": "./dist/vite.cjs"
34
+ },
30
35
  "./style.css": "./dist/bojuvue.css",
31
36
  "./dist/bojuvue.css": "./dist/bojuvue.css"
32
37
  },
33
38
  "scripts": {
34
- "build": "vue-tsc -b && vite build",
39
+ "build": "vue-tsc -b && vite build && vite build --config vite.plugin-cjs.config.ts",
35
40
  "test": "vitest run"
36
41
  },
37
42
  "devDependencies": {