diff --git a/packages/compiler-sfc/package.json b/packages/compiler-sfc/package.json index f29eb215..428cb97a 100644 --- a/packages/compiler-sfc/package.json +++ b/packages/compiler-sfc/package.json @@ -33,6 +33,7 @@ "@vue/shared": "3.0.0-alpha.8", "@vue/compiler-core": "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", "hash-sum": "^2.0.0", "lru-cache": "^5.1.1", diff --git a/packages/compiler-sfc/src/compileTemplate.ts b/packages/compiler-sfc/src/compileTemplate.ts index c6998ede..13bbd23f 100644 --- a/packages/compiler-sfc/src/compileTemplate.ts +++ b/packages/compiler-sfc/src/compileTemplate.ts @@ -32,6 +32,7 @@ export interface SFCTemplateCompileResults { export interface SFCTemplateCompileOptions { source: string filename: string + ssr?: boolean inMap?: RawSourceMap compiler?: TemplateCompiler compilerOptions?: CompilerOptions @@ -106,7 +107,8 @@ function doCompileTemplate({ filename, inMap, source, - compiler = require('@vue/compiler-dom'), + ssr = false, + compiler = ssr ? require('@vue/compiler-ssr') : require('@vue/compiler-dom'), compilerOptions = {}, transformAssetUrls }: SFCTemplateCompileOptions): SFCTemplateCompileResults {