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