vikejs / vike

🔨 Flexible, lean, community-driven, dependable, fast Vite-based frontend framework.
https://vike.dev
MIT License
4.39k stars 352 forks source link

Uncaught SyntaxError: import not found: getPage #326

Closed robinelvin closed 2 years ago

robinelvin commented 2 years ago

I'm trying to follow the instructions to incorporate vite-plugin-ssr into my existing app.

I'm using "vite-plugin-ssr": "^0.4.0-beta.24"

In VSCode I see this:

image

Running the dev server I also see the same error in the console:

Uncaught SyntaxError: import not found: getPage

Code generated:

var _jsxFileName = "/Users/rob/Projects/Elixir/core-develop/packages/core-ui/src/renderer/_default.page.client.tsx";
import __vite__cjsImport0_reactDom from "/node_modules/.vite/deps/react-dom.js?v=496a5d39"; const ReactDOM = __vite__cjsImport0_reactDom.__esModule ? __vite__cjsImport0_reactDom.default : __vite__cjsImport0_reactDom;
import __vite__cjsImport1_reduxFirstHistory_rr6 from "/node_modules/.vite/deps/redux-first-history_rr6.js?v=496a5d39"; const ConnectedRouter = __vite__cjsImport1_reduxFirstHistory_rr6["HistoryRouter"];
import { getPage } from "/@fs/Users/rob/Projects/Elixir/core-develop/node_modules/vite-plugin-ssr/dist/esm/client/index.js?v=496a5d39";
import "/@windicss/windi.css";
import getStore from "/src/ui-components/store.ts";
import __vite__cjsImport5_react_jsxDevRuntime from "/node_modules/.vite/deps/react_jsx-dev-runtime.js?v=496a5d39"; const _jsxDEV = __vite__cjsImport5_react_jsxDevRuntime["jsxDEV"];
const preloadedState = window.__PRELOADED_STATE__ || {};
const {
  history,
  store
} = getStore(preloadedState);
hydrate();
async function hydrate() {
  const pageContext = getPage();
  const {
    Page,
    pageProps
  } = pageContext;
  ReactDOM.hydrate(/* @__PURE__ */ _jsxDEV(ConnectedRouter, {
    history,
    children: /* @__PURE__ */ _jsxDEV(Page, {
      ...pageProps,
      history
    }, void 0, false, {
      fileName: _jsxFileName,
      lineNumber: 27,
      columnNumber: 13
    }, this)
  }, void 0, false, {
    fileName: _jsxFileName,
    lineNumber: 26,
    columnNumber: 9
  }, this), document.getElementById("react-root"));
}
brillout commented 2 years ago

Nominal.

Check the 0.4 branch's examples to get started with 0.4.

Or use 0.3.