Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
module.exports = function compileTemplate (template, filename, config) {
assertType({ filename }, 'string')
template = Template(template)
config = Config(config)
const options = config.options
options.scopeId = config.scopeId
options.modules = [].concat(options.modules || [], config.plugins || [], [
transformRequire(config.transformToRequire),
transformSrcset
])
const compile =
config.isServer && config.optimizeSSR !== false && compiler.ssrCompile
? compiler.ssrCompile
: compiler.compile
const compiled = compile(template.code, options)
const output = {
errors: compiled.errors,
tips: compiled.tips
}
if (output.errors && output.errors.length) {
output.code = `function render () {}\nvar staticRenderFns = []\n`
} else {
const stripWithFunctional =
template.descriptor.attrs && template.descriptor.attrs.functional
config.buble.transforms.stripWithFunctional = stripWithFunctional
output.code = transpile(
module.exports = function compileTemplate (template, filename, config) {
assertType({ filename }, 'string')
template = Template(template)
config = Config(config)
const options = config.options
options.scopeId = config.scopeId
options.modules = [].concat(options.modules || [], config.plugins || [], [
transformRequire(config.transformToRequire),
transformSrcset
])
const compile =
config.isServer && config.optimizeSSR !== false && compiler.ssrCompile
? compiler.ssrCompile
: compiler.compile
const compiled = compile(template.code, options)
const output = {
errors: compiled.errors,
tips: compiled.tips
}
if (output.errors && output.errors.length) {
output.code = `function render () {}\nvar staticRenderFns = []\n`
} else {
const stripWithFunctional =
template.descriptor.attrs && template.descriptor.attrs.functional
config.buble.transforms.stripWithFunctional = stripWithFunctional