Skip to content

Commit

Permalink
fix: ssr compile not use babel (fix #7)
Browse files Browse the repository at this point in the history
  • Loading branch information
JuniorTour committed Sep 3, 2021
1 parent c05e958 commit 5e8a17d
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 0 deletions.
1 change: 1 addition & 0 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ function extendTemplateCompiler(obj) {
obj[key] = templateCompiler[key];
}

obj.ssrCompile = compileTemplate;
obj.compile = compileTemplate;
}

Expand Down
1 change: 1 addition & 0 deletions src/templateCompiler.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,5 +57,6 @@ export function extendTemplateCompiler(obj) {
for (const key in templateCompiler) {
obj[key] = templateCompiler[key]
}
obj.ssrCompile = compileTemplate
obj.compile = compileTemplate
}
3 changes: 3 additions & 0 deletions test/compileTemplate.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,9 @@ test('should extend template compile', () => {
expect(typeof templateCompiler.ssrCompile).toMatch(functionType)
expect(typeof templateCompiler.ssrCompileToFunctions).toMatch(functionType)
expect(typeof templateCompiler.generateCodeFrame).toMatch(functionType)

// use same compiler for ssr and non-ssr, fix: https://github.com/JuniorTour/vue-template-babel-compiler/issues/7
expect(templateCompiler.ssrCompile).toEqual(templateCompiler.compile)
})

test('should work for functional component', () => {
Expand Down

0 comments on commit 5e8a17d

Please sign in to comment.