How to use the vue-template-compiler.ssrCompile function in vue-template-compiler

To help you get started, we’ve selected a few vue-template-compiler examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github vuejs / vue-loader / lib / template-compiler / index.js View on Github external
if (typeof userModules === 'string') {
    userModules = require(userModules)
  }

  const compilerOptions = {
    preserveWhitespace: options.preserveWhitespace,
    modules: defaultModules.concat(userModules || []),
    directives:
      vueOptions.compilerDirectives || options.compilerDirectives || {},
    scopeId: options.hasScoped ? options.id : null,
    comments: options.hasComment
  }

  const compile =
    isServer && compiler.ssrCompile && vueOptions.optimizeSSR !== false
      ? compiler.ssrCompile
      : compiler.compile

  const compiled = compile(html, compilerOptions)

  // tips
  if (compiled.tips && compiled.tips.length) {
    compiled.tips.forEach(tip => {
      this.emitWarning(tip)
    })
  }

  let code
  if (compiled.errors && compiled.errors.length) {
    this.emitError(
      `\n  Error compiling template:\n${pad(html)}\n` +
        compiled.errors.map(e => `  - ${e}`).join('\n') +
github michaelolof / vue-literal-compiler / src / index.ts View on Github external
//@ts-ignore
import * as compiler from "vue-template-compiler";
import { parseComponent as _parseComponent } from "./new-parse-component"

export const parseComponent = _parseComponent;
// export const parseComponent = _parseComponent
export const compile = compiler.compile;
export const compileToFunctions = compiler.compileToFunctions;
export const ssrCompile = compiler.ssrCompile;
export const ssrCompileToFunctions = compiler.ssrCompileToFunctions;
github vuejs / vue-loader / lib / template-compiler / index.js View on Github external
// for HappyPack cross-process use cases
  if (typeof userModules === 'string') {
    userModules = require(userModules)
  }

  const compilerOptions = {
    preserveWhitespace: options.preserveWhitespace,
    modules: defaultModules.concat(userModules || []),
    directives:
      vueOptions.compilerDirectives || options.compilerDirectives || {},
    scopeId: options.hasScoped ? options.id : null,
    comments: options.hasComment
  }

  const compile =
    isServer && compiler.ssrCompile && vueOptions.optimizeSSR !== false
      ? compiler.ssrCompile
      : compiler.compile

  const compiled = compile(html, compilerOptions)

  // tips
  if (compiled.tips && compiled.tips.length) {
    compiled.tips.forEach(tip => {
      this.emitWarning(tip)
    })
  }

  let code
  if (compiled.errors && compiled.errors.length) {
    this.emitError(
      `\n  Error compiling template:\n${pad(html)}\n` +