wip: new cssVars SSR integration + fix cssVars SSR injection for suspense

This commit is contained in:
Evan You
2020-11-17 18:54:47 -05:00
parent 9297410569
commit cdc9f336fd
15 changed files with 117 additions and 103 deletions

View File

@@ -22,6 +22,7 @@ import { isObject } from '@vue/shared'
import * as CompilerDOM from '@vue/compiler-dom'
import * as CompilerSSR from '@vue/compiler-ssr'
import consolidate from 'consolidate'
import { warnOnce } from './warn'
export interface TemplateCompiler {
compile(template: string, options: CompilerOptions): CodegenResult
@@ -170,6 +171,14 @@ function doCompileTemplate({
nodeTransforms = [transformAssetUrl, transformSrcset]
}
if (ssr && !compilerOptions.ssrCssVars) {
warnOnce(
`compileTemplate is called with \`ssr: true\` but no ` +
`corresponding \`ssrCssVars\` option. The value can be generated by ` +
`calling \`generateCssVars(sfcDescriptor, scopeId, isProduction)\`.`
)
}
let { code, ast, preamble, map } = compiler.compile(source, {
mode: 'module',
prefixIdentifiers: true,