mirror of
https://github.com/tenrok/vue-meta.git
synced 2026-06-15 01:12:24 +03:00
fix: dont include ssr support in main dist
This commit is contained in:
@@ -144,7 +144,7 @@ unmount() // Remove metadata when needed
|
||||
|
||||
```js
|
||||
import { createSSRApp } from 'vue'
|
||||
import { renderToStringWithMeta } from 'vue-meta'
|
||||
import { renderToStringWithMeta } from 'vue-meta/ssr'
|
||||
import { App, metaManager } from './App'
|
||||
|
||||
export function renderPage() {
|
||||
|
||||
+20
-8
@@ -32,6 +32,7 @@ function rollupConfig({
|
||||
const isProductionBuild = config.output.file.includes('.prod.')
|
||||
|
||||
const replaceConfig = {
|
||||
preventAssignment: true,
|
||||
exclude: 'node_modules',
|
||||
delimiters: ['', ''],
|
||||
values: {
|
||||
@@ -154,12 +155,23 @@ export default [
|
||||
file: pkg.module.replace('-bundler.js', '-browser.min.js'),
|
||||
format: 'es'
|
||||
},
|
||||
},
|
||||
// SSR build
|
||||
{
|
||||
input: 'src/ssr.ts',
|
||||
output: {
|
||||
file: 'ssr/index.js',
|
||||
format: 'es'
|
||||
},
|
||||
},
|
||||
|
||||
].map(rollupConfig).concat([
|
||||
{
|
||||
input: path.resolve(__dirname, '../dist/src/index.d.ts'),
|
||||
output: [{
|
||||
file: `dist/${pkg.name}.d.ts`,
|
||||
format: 'es',
|
||||
}],
|
||||
plugins: [dts()],
|
||||
}
|
||||
].map(rollupConfig).concat([{
|
||||
input: path.resolve(__dirname, '../dist/src/index.d.ts'),
|
||||
output: [{
|
||||
file: `dist/${pkg.name}.d.ts`,
|
||||
format: 'es',
|
||||
}],
|
||||
plugins: [dts()],
|
||||
}])
|
||||
])
|
||||
|
||||
+4
-4
@@ -12,6 +12,7 @@
|
||||
"files": [
|
||||
"dist/*.js",
|
||||
"dist/vue-meta.d.ts",
|
||||
"ssr/*.js",
|
||||
"README.md"
|
||||
],
|
||||
"types": "dist/vue-meta.d.ts",
|
||||
@@ -69,8 +70,7 @@
|
||||
"@typescript-eslint/parser": "^4.15.2",
|
||||
"@vue/compiler-sfc": "^3.0.6",
|
||||
"@vue/server-renderer": "^3.0.6",
|
||||
"@vue/server-test-utils": "^1.1.3",
|
||||
"@vue/test-utils": "^1.1.3",
|
||||
"@vue/test-utils": "next",
|
||||
"@wishy-gift/html-include-chunks-webpack-plugin": "^0.1.5",
|
||||
"babel-jest": "^26.6.3",
|
||||
"babel-loader": "^8.2.2",
|
||||
@@ -106,8 +106,8 @@
|
||||
"ts-loader": "^8.0.17",
|
||||
"typescript": "^4.2.2",
|
||||
"vite": "^2.0.4",
|
||||
"vue": "^3.0.5",
|
||||
"vue-jest": "^3.0.7",
|
||||
"vue": "^3.0.6",
|
||||
"vue-jest": "next",
|
||||
"vue-loader": "^16.0.0",
|
||||
"vue-router": "next",
|
||||
"webpack": "^5.24.2",
|
||||
|
||||
@@ -4,7 +4,6 @@ export { defaultConfig } from './config'
|
||||
export { createMetaManager } from './manager'
|
||||
export { resolveOption } from './resolvers'
|
||||
|
||||
export * from './ssr'
|
||||
export * from './types'
|
||||
export * from './useApi'
|
||||
|
||||
|
||||
+1
-2
@@ -1,9 +1,8 @@
|
||||
import { renderToString } from '@vue/server-renderer'
|
||||
import type { App } from 'vue'
|
||||
import type { SSRContext } from '@vue/server-renderer'
|
||||
|
||||
export async function renderToStringWithMeta (app: App): Promise<[string, SSRContext]> {
|
||||
const { renderToString } = await import('@vue/server-renderer')
|
||||
|
||||
const ctx: SSRContext = {}
|
||||
|
||||
const html = await renderToString(app, ctx)
|
||||
|
||||
Reference in New Issue
Block a user