Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: set ssr manifest path #256

Merged
merged 1 commit into from
Sep 22, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion playground/ssr-vue/__tests__/serve.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export async function serve(): Promise<{ close(): Promise<void> }> {
build: {
target: 'esnext',
minify: false,
ssrManifest: true,
ssrManifest: '.vite/ssr-manifest.json',
outDir: 'dist/client',
},
})
Expand Down
2 changes: 1 addition & 1 deletion playground/ssr-vue/__tests__/ssr-vue.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,7 @@ test.runIf(isBuild)('dynamic css file should be preloaded', async () => {
await import(
resolve(
process.cwd(),
'./playground-temp/ssr-vue/dist/client/ssr-manifest.json',
'./playground-temp/ssr-vue/dist/client/.vite/ssr-manifest.json',
)
)
).default
Expand Down
4 changes: 2 additions & 2 deletions playground/ssr-vue/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
"dev": "node server",
"build": "npm run build:client && npm run build:server",
"build:noExternal": "npm run build:client && npm run build:server:noExternal",
"build:client": "vite build --ssrManifest --outDir dist/client",
"build:client": "vite build --ssrManifest .vite/ssr-manifest.json --outDir dist/client",
"build:server": "vite build --ssr src/entry-server.js --outDir dist/server",
"build:server:noExternal": "vite build --config vite.config.noexternal.js --ssr src/entry-server.js --outDir dist/server",
"generate": "vite build --ssrManifest --outDir dist/static && npm run build:server && node prerender",
"generate": "vite build --ssrManifest .vite/ssr-manifest.json --outDir dist/static && npm run build:server && node prerender",
"serve": "NODE_ENV=production node server",
"debug": "node --inspect-brk server"
},
Expand Down
6 changes: 3 additions & 3 deletions playground/ssr-vue/prerender.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const __dirname = path.dirname(url.fileURLToPath(import.meta.url))
const toAbsolute = (p) => path.resolve(__dirname, p)

const manifest = JSON.parse(
fs.readFileSync(toAbsolute('dist/static/ssr-manifest.json'), 'utf-8'),
fs.readFileSync(toAbsolute('dist/static/.vite/ssr-manifest.json'), 'utf-8'),
)
const template = fs.readFileSync(toAbsolute('dist/static/index.html'), 'utf-8')
const { render } = await import('./dist/server/entry-server.js')
Expand All @@ -37,6 +37,6 @@ const routesToPrerender = fs
console.log('pre-rendered:', filePath)
}

// done, delete ssr manifest
fs.unlinkSync(toAbsolute('dist/static/ssr-manifest.json'))
// done, delete .vite directory including ssr manifest
fs.rmSync(toAbsolute('dist/static/.vite'), { recursive: true })
})()
5 changes: 4 additions & 1 deletion playground/ssr-vue/server.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,10 @@ export async function createServer(

const manifest = isProd
? JSON.parse(
fs.readFileSync(resolve('dist/client/ssr-manifest.json'), 'utf-8'),
fs.readFileSync(
resolve('dist/client/.vite/ssr-manifest.json'),
'utf-8',
),
)
: {}

Expand Down