Code Monkey home page Code Monkey logo

Comments (6)

frandiox avatar frandiox commented on May 28, 2024

@techieoriname Thanks! You should be able to pass routerOptions next to routes or base: export default vitedge(App, { routes, routerOptions }, () => {}). Vitedge is passing it to Vite SSR, and used here.

from vitessedge-template.

techieoriname avatar techieoriname commented on May 28, 2024

I get an error on my IDE when I include it

TS2345: Argument of type '{ routes: RouteRecordRaw[]; routerOptions: { scrollBehavior(to: RouteLocationNormalized, from: RouteLocationNormalizedLoaded, savedPosition: { left: number; right: number; }): { left: number; right: number; } | { behavior: string; left: number; top: number; }; }; base: ({ url }: { ...; }) => string; }' is not assignable to parameter of type '{ routes: Record<string, any>[]; base?: ((params: { url: URL; }) => string) | undefined; pageProps?: { passToPage: boolean; } | undefined; debug?: { mount?: boolean | undefined; } | undefined; styleCollector?: any; }'.   Object literal may only specify known properties, and 'routerOptions' does not exist in type '{ routes: Record<string, any>[]; base?: ((params: { url: URL; }) => string) | undefined; pageProps?: { passToPage: boolean; } | undefined; debug?: { mount?: boolean | undefined; } | undefined; styleCollector?: any; }'.

from vitessedge-template.

frandiox avatar frandiox commented on May 28, 2024

I think the types might be wrong in Vitedge (they are correct in Vite SSR) because this project is still written in pure JS. Can you put a // @ts-ignore on top of it and see if it actually works?

from vitessedge-template.

techieoriname avatar techieoriname commented on May 28, 2024

I think the types might be wrong in Vitedge (they are correct in Vite SSR) because this project is still written in pure JS. Can you put a // @ts-ignore on top of it and see if it actually works?

image

The scroll behaviour doesn't work yet

from vitessedge-template.

frandiox avatar frandiox commented on May 28, 2024

No no, you need to wrap it in routerOptions (for Vue.js):

export default vitedge(App, { routes, routerOptions: { scrollBehavior }, () => {});

You don't need to pass the history, it's done automatically.

from vitessedge-template.

techieoriname avatar techieoriname commented on May 28, 2024

This actually works, but my console is filled up... log below:

4:04:24 PM [vite] Error when evaluating SSR module /node_modules/whatwg-url/lib/public-api.js?v=e3db2eb4:
ReferenceError: exports is not defined
    at /node_modules/whatwg-url/lib/public-api.js?v=e3db2eb4:3:1
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:156:11)
4:04:24 PM [vite] Error when evaluating SSR module /node_modules/node-fetch/lib/index.mjs?v=e3db2eb4:
ReferenceError: exports is not defined
    at /node_modules/whatwg-url/lib/public-api.js?v=e3db2eb4:1:1
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:156:11)
4:04:24 PM [vite] Error when evaluating SSR module /node_modules/firebase/storage/dist/index.mjs?v=e3db2eb4:
TypeError: Line must be greater than or equal to 1, got -1
    at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:584:13)
    at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:653:22)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:38:32
    at String.replace (<anonymous>)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:22:19
    at Array.map (<anonymous>)
    at ssrRewriteStacktrace (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:21:6)
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:165:24)
4:04:24 PM [vite] Error when evaluating SSR module /src/utils/functions.ts:
TypeError: Line must be greater than or equal to 1, got -1
    at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:584:13)
    at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:653:22)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:38:32
    at String.replace (<anonymous>)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:22:19
    at Array.map (<anonymous>)
    at ssrRewriteStacktrace (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:21:6)
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:165:24)
4:04:24 PM [vite] Error when evaluating SSR module /src/components/Navbar.vue:
TypeError: Line must be greater than or equal to 1, got -1
    at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:584:13)
    at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:653:22)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:38:32
    at String.replace (<anonymous>)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:22:19
    at Array.map (<anonymous>)
    at ssrRewriteStacktrace (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:21:6)
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:165:24)
4:04:24 PM [vite] Error when evaluating SSR module /src/layouts/Default.vue:
TypeError: Line must be greater than or equal to 1, got -1
    at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:584:13)
    at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:653:22)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:38:32
    at String.replace (<anonymous>)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:22:19
    at Array.map (<anonymous>)
    at ssrRewriteStacktrace (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:21:6)
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:165:24)
4:04:24 PM [vite] Error when evaluating SSR module /src/routes/index.ts:
TypeError: Line must be greater than or equal to 1, got -1
    at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:584:13)
    at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:653:22)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:38:32
    at String.replace (<anonymous>)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:22:19
    at Array.map (<anonymous>)
    at ssrRewriteStacktrace (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:21:6)
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:165:24)
4:04:24 PM [vite] Error when evaluating SSR module /Users/techieoriname/GitHub/vite-edge/src/main.ts:
TypeError: Line must be greater than or equal to 1, got -1
    at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:584:13)
    at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:653:22)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:38:32
    at String.replace (<anonymous>)
    at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:22:19
    at Array.map (<anonymous>)
    at ssrRewriteStacktrace (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:21:6)
    at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:165:24)
4:04:24 PM [vite] Internal server error: Line must be greater than or equal to 1, got -1
      at BasicSourceMapConsumer.SourceMapConsumer_findMapping [as _findMapping] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:584:13)
      at BasicSourceMapConsumer.SourceMapConsumer_originalPositionFor [as originalPositionFor] (/Users/techieoriname/GitHub/vite-edge/node_modules/.pnpm/[email protected]/node_modules/source-map/lib/source-map-consumer.js:653:22)
      at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:38:32
      at String.replace (<anonymous>)
      at /Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:22:19
      at Array.map (<anonymous>)
      at ssrRewriteStacktrace (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrStacktrace.ts:21:6)
      at instantiateModule (/Users/techieoriname/GitHub/vite-edge/node_modules/vite/src/node/ssr/ssrModuleLoader.ts:165:24)


from vitessedge-template.

Related Issues (11)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.