@wrdagency/react-islands 0.1.0 → 0.1.2
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 +13 -5
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1624 -2993
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1623 -2993
- package/dist/index.mjs.map +1 -1
- package/dist/server.js +1600 -2970
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1624 -2994
- package/dist/server.mjs.map +1 -1
- package/package.json +17 -5
- package/src/index.tsx +4 -2
- package/tsconfig.json +0 -14
- package/tsup.config.ts +0 -10
package/README.md
CHANGED
|
@@ -10,8 +10,8 @@ Create your island. Here we use an existing component and use our Islands direct
|
|
|
10
10
|
|
|
11
11
|
```
|
|
12
12
|
// ./islands/my-component.tsx
|
|
13
|
-
import MyComponent from "
|
|
14
|
-
import createIsland from "
|
|
13
|
+
import MyComponent from "./components";
|
|
14
|
+
import { createIsland } from "@wrdagency/react-islands";
|
|
15
15
|
|
|
16
16
|
export const myComponentIsland = createIsland(MyComponent, {
|
|
17
17
|
name: "my-component",
|
|
@@ -44,7 +44,7 @@ Create a pre-render script. You can configure your build tool to use this as a s
|
|
|
44
44
|
import path from "node:path";
|
|
45
45
|
import { fileURLToPath } from "node:url";
|
|
46
46
|
import * as islands from "./islands";
|
|
47
|
-
import { prerenderIslands } from "
|
|
47
|
+
import { prerenderIslands } from "@wrdagency/react-islands/server";
|
|
48
48
|
|
|
49
49
|
const __filename = fileURLToPath(import.meta.url);
|
|
50
50
|
const __dirname = path.dirname(__filename);
|
|
@@ -56,13 +56,21 @@ prerenderIslands({ islands, outDir });
|
|
|
56
56
|
For our example we're using Vite. We'll build our prerendering script.
|
|
57
57
|
|
|
58
58
|
```
|
|
59
|
-
npx vite build --ssr src/prerender.tsx --outDir
|
|
59
|
+
npx vite build --ssr ./src/prerender.tsx --outDir ./dist
|
|
60
60
|
```
|
|
61
61
|
|
|
62
62
|
And then we can run that compiled script. It'll create all of our statically rendered islands and put them into the `outDir` we specified.
|
|
63
63
|
|
|
64
64
|
```
|
|
65
|
-
node
|
|
65
|
+
node ./dist/prerender.js
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
For convenience we'd recommend setting up a script in your `package.json` for this like so:
|
|
69
|
+
|
|
70
|
+
```
|
|
71
|
+
"scripts": {
|
|
72
|
+
"prerender": "npx vite build --ssr ./src/prerender.tsx --outDir ./dist && node ./dist/prerender.js",
|
|
73
|
+
},
|
|
66
74
|
```
|
|
67
75
|
|
|
68
76
|
## API
|
package/dist/index.d.mts
CHANGED
package/dist/index.d.ts
CHANGED