@greatstore/cli 0.0.3 → 0.0.5

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/dist/cli.js +21 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -743,8 +743,19 @@ function viteConfig() {
743
743
  return `import { defineConfig } from "vite";
744
744
  import react from "@vitejs/plugin-react";
745
745
 
746
- // Builds a single ESM bundle suitable for \`gs push\`. React + ReactDOM
747
- // are externalized \u2014 the GreatStore runtime provides them at load time.
746
+ // Builds a single ESM bundle suitable for \`gs push\`.
747
+ //
748
+ // React / react-dom / react/jsx-runtime are EXTERNALIZED and rewritten
749
+ // at build time to point at GreatStore's runtime shim at
750
+ // \`/assets/remote-components/_runtime.js\`. The shim re-exports the host
751
+ // chat tree's React instance off \`window.__GS_REMOTE_RUNTIME__\`, so
752
+ // the component and the host share one React. Bundling React in
753
+ // instead would crash on the first hook call because the bundled-in
754
+ // React's dispatcher is null when the chat tree drives the render.
755
+ //
756
+ // Do NOT remove the \`paths\` mapping \u2014 without it the browser tries to
757
+ // resolve a bare \`react\` specifier and fails before the component
758
+ // renders.
748
759
  export default defineConfig({
749
760
  plugins: [react()],
750
761
  build: {
@@ -757,7 +768,14 @@ export default defineConfig({
757
768
  emptyOutDir: false,
758
769
  rollupOptions: {
759
770
  external: ["react", "react-dom", "react/jsx-runtime"],
760
- output: { entryFileNames: "bundle.js" },
771
+ output: {
772
+ entryFileNames: "bundle.js",
773
+ paths: {
774
+ react: "/assets/remote-components/_runtime.js",
775
+ "react-dom": "/assets/remote-components/_runtime.js",
776
+ "react/jsx-runtime": "/assets/remote-components/_runtime.js",
777
+ },
778
+ },
761
779
  },
762
780
  minify: true,
763
781
  sourcemap: false,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@greatstore/cli",
3
- "version": "0.0.3",
3
+ "version": "0.0.5",
4
4
  "description": "CLI for authoring and shipping GreatStore custom components.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",