This project seems awesome ! I'm trying to test it, so I'm following documentation steps but I can't make it works:
~/d/f/serverless LANG=C vitedge dev --ssr 1041ms mar. 27 avril 2021 12:11:47
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
(node:27981) ExperimentalWarning: --experimental-loader is an experimental feature. This feature could change at any time
(Use `node --trace-warnings ...` to show where the warning was created)
fatal: not a git repository (or any parent up to mount point /)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Pre-bundling dependencies:
vitedge
vue
vitedge/vue/entry-client
vitedge/vue/entry-server
vite-ssr/vue/entry-client
(...and 1 more)
(this will be run only when your dependencies or config have changed)
> node_modules/vite-ssr/vue/entry-client.js:2:47: error: Could not resolve "vue-router" (mark it as external to exclude it from the bundle)
2 │ import { createRouter, createWebHistory } from 'vue-router';
╵ ~~~~~~~~~~~~
> node_modules/vitedge/vue/entry-server.js:3:27: error: Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)
3 │ import { createHead } from '@vueuse/head'
╵ ~~~~~~~~~~~~~~
> node_modules/vitedge/vue/entry-client.js:4:27: error: Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)
4 │ import { createHead } from '@vueuse/head'
╵ ~~~~~~~~~~~~~~
> node_modules/vitedge/vue/utils.js:1:50: error: Could not resolve "vue-router" (mark it as external to exclude it from the bundle)
1 │ import { createRouter, createMemoryHistory } from 'vue-router'
╵ ~~~~~~~~~~~~
> node_modules/vite-ssr/vue/entry-server.js:3:50: error: Could not resolve "vue-router" (mark it as external to exclude it from the bundle)
3 │ import { createRouter, createMemoryHistory } from 'vue-router';
╵ ~~~~~~~~~~~~
> node_modules/vite-ssr/vue/entry-server.js:8:35: error: Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)
8 │ import { renderHeadToString } from '@vueuse/head';
╵ ~~~~~~~~~~~~~~
/home/guillaume/dev/serverless/node_modules/esbuild/lib/main.js:1224
let error = new Error(`${text}${summary}`);
^
Error: Build failed with 6 errors:
node_modules/vite-ssr/vue/entry-client.js:2:47: error: Could not resolve "vue-router" (mark it as external to exclude it from the bundle)
node_modules/vite-ssr/vue/entry-server.js:3:50: error: Could not resolve "vue-router" (mark it as external to exclude it from the bundle)
node_modules/vite-ssr/vue/entry-server.js:8:35: error: Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)
node_modules/vitedge/vue/entry-client.js:4:27: error: Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)
node_modules/vitedge/vue/entry-server.js:3:27: error: Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)
...
at failureErrorWithLog (/home/guillaume/dev/serverless/node_modules/esbuild/lib/main.js:1224:15)
at buildResponseToResult (/home/guillaume/dev/serverless/node_modules/esbuild/lib/main.js:936:32)
at /home/guillaume/dev/serverless/node_modules/esbuild/lib/main.js:1035:20
at /home/guillaume/dev/serverless/node_modules/esbuild/lib/main.js:568:9
at handleIncomingPacket (/home/guillaume/dev/serverless/node_modules/esbuild/lib/main.js:657:9)
at Socket.readFromStdout (/home/guillaume/dev/serverless/node_modules/esbuild/lib/main.js:535:7)
at Socket.emit (node:events:378:20)
at addChunk (node:internal/streams/readable:313:12)
at readableAddChunk (node:internal/streams/readable:288:9)
at Socket.Readable.push (node:internal/streams/readable:227:10) {
errors: [
{
detail: undefined,
location: {
column: 47,
file: 'node_modules/vite-ssr/vue/entry-client.js',
length: 12,
line: 2,
lineText: "import { createRouter, createWebHistory } from 'vue-router';",
namespace: ''
},
notes: [],
text: 'Could not resolve "vue-router" (mark it as external to exclude it from the bundle)'
},
{
detail: undefined,
location: {
column: 50,
file: 'node_modules/vite-ssr/vue/entry-server.js',
length: 12,
line: 3,
lineText: "import { createRouter, createMemoryHistory } from 'vue-router';",
namespace: ''
},
notes: [],
text: 'Could not resolve "vue-router" (mark it as external to exclude it from the bundle)'
},
{
detail: undefined,
location: {
column: 35,
file: 'node_modules/vite-ssr/vue/entry-server.js',
length: 14,
line: 8,
lineText: "import { renderHeadToString } from '@vueuse/head';",
namespace: ''
},
notes: [],
text: 'Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)'
},
{
detail: undefined,
location: {
column: 27,
file: 'node_modules/vitedge/vue/entry-client.js',
length: 14,
line: 4,
lineText: "import { createHead } from '@vueuse/head'",
namespace: ''
},
notes: [],
text: 'Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)'
},
{
detail: undefined,
location: {
column: 27,
file: 'node_modules/vitedge/vue/entry-server.js',
length: 14,
line: 3,
lineText: "import { createHead } from '@vueuse/head'",
namespace: ''
},
notes: [],
text: 'Could not resolve "@vueuse/head" (mark it as external to exclude it from the bundle)'
},
{
detail: undefined,
location: {
column: 50,
file: 'node_modules/vitedge/vue/utils.js',
length: 12,
line: 1,
lineText: "import { createRouter, createMemoryHistory } from 'vue-router'",
namespace: ''
},
notes: [],
text: 'Could not resolve "vue-router" (mark it as external to exclude it from the bundle)'
}
],
warnings: [
{
detail: undefined,
location: {
column: 63,
file: 'node_modules/@vue/server-renderer/dist/server-renderer.cjs.js',
length: 7,
line: 99,
lineText: " return (compileCache[template] = Function('require', code)(require));",
namespace: ''
},
notes: [],
text: 'Indirect calls to "require" will not be bundled (surround with a try/catch to silence this warning)'
}
]
}
~/d npm init @vitejs/app serverless --template vue 425ms mar. 27 avril 2021 11:50:13
✔ Select a framework: · vue
✔ Select a variant: · JavaScript
Scaffolding project in /home/guillaume/dev/serverless...
Done. Now run:
cd serverless
npm install
npm run dev
~/d cd serverless/ 5.3s mar. 27 avril 2021 11:50:42
~/d/serverless npm install mar. 27 avril 2021 11:50:44
added 55 packages, and audited 56 packages in 5s
3 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
~/d/serverless npm i vitedge 5.1s mar. 27 avril 2021 11:51:20
npm WARN EBADENGINE Unsupported engine {
npm WARN EBADENGINE package: '[email protected]',
npm WARN EBADENGINE required: { node: 'node >= 14' },
npm WARN EBADENGINE current: { node: 'v15.11.0', npm: '7.6.0' }
npm WARN EBADENGINE }
added 74 packages, and audited 130 packages in 9s
8 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
~/d/serverless mkdir -p functions/props 9.7s mar. 27 avril 2021 11:51:54
~/d/serverless mkdir -p functions/api
import { defineConfig } from 'vite'
import vitedgePlugin from 'vitedge/plugin.js'
import vue from '@vitejs/plugin-vue'
// https://vitejs.dev/config/
export default defineConfig({
plugins: [vitedgePlugin(), vue()]
})
import './index.css'
import App from './App.vue' // App.jsx
import routes from './routes'
import vitedge from 'vitedge'
export default vitedge(
App,
{ routes },
({ app, router, isClient, initialState }) => {
// Custom setup hook.
// E.g. set initialState in a store, install plugins, etc.
}
)
( it's not explained in the documentation, but I've took a part of a routes.js from the samples on your git )
/src/routes.js
export default [
{
path: '/',
component: () => import('./pages/home.vue'),
name: 'home',
meta: {
propsGetter: 'default',
},
},
{
path: '/:catchAll(.*)',
name: 'not-found',
component: () => import('./pages/404.vue'),
meta: {
propsGetter: false,
},
},
]
<template>
<div>
<h1>Not found</h1>
<a href="/">Home</a>
</div>
</template>
<template>
<div>
<h1>Homepage</h1>
<a href="/">Home</a>
</div>
</template>
BTW if I start the server without the --ssr mode, I can go on the localhost:3000 but with an empty white page and my browser try 2 requests for index.html and favicon with a 404 error.