Comments (6)
@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.
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.
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.
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?
The scroll behaviour doesn't work yet
from vitessedge-template.
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.
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)
- Cannot start SSR dev HOT 4
- dev server error
- Error [ERR_LOADER_CHAIN_INCOMPLETE]: "vitedge/dev/ts-loader.js 'resolve'" did not call the next hook in its chain and did not explicitly signal a short circuit. If this is intentional, include `shortCircuit: true` in the hook's return. HOT 1
- How fetch KV data and use is components server side HOT 2
- Dev: Invalid module "node_modules/bin/vite-ssr" on Windows HOT 5
- Client side only code HOT 2
- Issue in installing and using vite-radar-plugins HOT 2
- Cannot read properties of undefined (reading 'DEV') HOT 2
- import.meta" is not available in the configured target environment ("chrome87", "edge88", "es2019", "firefox78", "safari13.1")
- Wrangler@2 Toml Format
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from vitessedge-template.