Skip to content

Commit

Permalink
fix: use babel to transpile template code
Browse files Browse the repository at this point in the history
  • Loading branch information
lmiller1990 committed Jul 29, 2020
1 parent e0cbca7 commit 5e9a544
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 16 deletions.
2 changes: 1 addition & 1 deletion lib/generate-code.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module.exports = function generateCode(
}

if (templateResult) {
output += `${templateResult.outputText};\n`
output += `${templateResult.code};\n`
}

if (output.includes('exports.render = render;')) {
Expand Down
21 changes: 6 additions & 15 deletions lib/process.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { transpileModule } = require('typescript')
const { parse, compileTemplate } = require('@vue/compiler-sfc')
const { transform } = require('@babel/core')
const convertSourceMap = require('convert-source-map')
const babelTransformer = require('babel-jest')

Expand Down Expand Up @@ -67,22 +67,13 @@ function processTemplate(template, filename, config) {
preprocessOptions: vueJestConfig[template.lang]
})

// const result = compilerUtils.compileTemplate({
// source: template.content,
// compiler: VueTemplateCompiler,
// filename: filename,
// compilerOptions: {
// optimize: false
// },
// isFunctional: template.attrs.functional,
// preprocessLang: template.lang,
// preprocessOptions: vueJestConfig[template.lang]
// })

logResultErrors(result)

const tsconfig = getTsJestConfig(config)
return transpileModule(result.code, tsconfig)
const babelify = transform(result.code, { filename: 'file.js' })

return {
code: babelify.code
}
}

function processStyle(styles, filename, config) {
Expand Down

0 comments on commit 5e9a544

Please sign in to comment.