feat(compiler-sfc): add ssr option

This commit is contained in:
Evan You 2020-03-16 16:24:49 -04:00
parent 38f0269765
commit 3b2d236714
2 changed files with 4 additions and 1 deletions

View File

@ -33,6 +33,7 @@
"@vue/shared": "3.0.0-alpha.8", "@vue/shared": "3.0.0-alpha.8",
"@vue/compiler-core": "3.0.0-alpha.8", "@vue/compiler-core": "3.0.0-alpha.8",
"@vue/compiler-dom": "3.0.0-alpha.8", "@vue/compiler-dom": "3.0.0-alpha.8",
"@vue/compiler-ssr": "3.0.0-alpha.8",
"consolidate": "^0.15.1", "consolidate": "^0.15.1",
"hash-sum": "^2.0.0", "hash-sum": "^2.0.0",
"lru-cache": "^5.1.1", "lru-cache": "^5.1.1",

View File

@ -32,6 +32,7 @@ export interface SFCTemplateCompileResults {
export interface SFCTemplateCompileOptions { export interface SFCTemplateCompileOptions {
source: string source: string
filename: string filename: string
ssr?: boolean
inMap?: RawSourceMap inMap?: RawSourceMap
compiler?: TemplateCompiler compiler?: TemplateCompiler
compilerOptions?: CompilerOptions compilerOptions?: CompilerOptions
@ -106,7 +107,8 @@ function doCompileTemplate({
filename, filename,
inMap, inMap,
source, source,
compiler = require('@vue/compiler-dom'), ssr = false,
compiler = ssr ? require('@vue/compiler-ssr') : require('@vue/compiler-dom'),
compilerOptions = {}, compilerOptions = {},
transformAssetUrls transformAssetUrls
}: SFCTemplateCompileOptions): SFCTemplateCompileResults { }: SFCTemplateCompileOptions): SFCTemplateCompileResults {