@vistagenic/vista 0.2.1 → 0.2.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/dist/bin/build-rsc.js +6 -4
- package/package.json +1 -1
package/dist/bin/build-rsc.js
CHANGED
|
@@ -53,7 +53,7 @@ function runPostCSS(cwd, vistaDir) {
|
|
|
53
53
|
/**
|
|
54
54
|
* Generate the RSC-aware client entry file
|
|
55
55
|
*/
|
|
56
|
-
function generateRSCClientEntry(cwd, vistaDir) {
|
|
56
|
+
function generateRSCClientEntry(cwd, vistaDir, isDev) {
|
|
57
57
|
const clientEntryContent = `/**
|
|
58
58
|
* Vista RSC Client Entry
|
|
59
59
|
*
|
|
@@ -89,7 +89,8 @@ hydrateRoot(
|
|
|
89
89
|
})
|
|
90
90
|
);
|
|
91
91
|
|
|
92
|
-
|
|
92
|
+
${isDev
|
|
93
|
+
? `// Vista live-reload: listen for server component changes via SSE
|
|
93
94
|
(function connectReload() {
|
|
94
95
|
const es = new EventSource('${constants_1.SSE_ENDPOINT}');
|
|
95
96
|
es.onmessage = (e) => {
|
|
@@ -108,7 +109,8 @@ hydrateRoot(
|
|
|
108
109
|
es.close();
|
|
109
110
|
setTimeout(connectReload, 3000);
|
|
110
111
|
};
|
|
111
|
-
})()
|
|
112
|
+
})();`
|
|
113
|
+
: '// SSE live-reload disabled in production'}
|
|
112
114
|
`;
|
|
113
115
|
fs_1.default.writeFileSync(path_1.default.join(vistaDir, 'rsc-client.tsx'), clientEntryContent);
|
|
114
116
|
if (_debug)
|
|
@@ -257,7 +259,7 @@ async function buildRSC(watch = false) {
|
|
|
257
259
|
type: route.type,
|
|
258
260
|
})));
|
|
259
261
|
// Generate client entry
|
|
260
|
-
generateRSCClientEntry(cwd, vistaDirs.root);
|
|
262
|
+
generateRSCClientEntry(cwd, vistaDirs.root, watch);
|
|
261
263
|
// Create webpack configs
|
|
262
264
|
const options = {
|
|
263
265
|
cwd,
|