Skip to content

Commit 76b0759

Browse files
committed
fix: add acorn-jsx to avoid conflict in vuepress
1 parent 498e06d commit 76b0759

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
},
1414
"dependencies": {
1515
"acorn": "^6.1.1",
16+
"acorn-jsx": "^5.0.1",
1617
"buble": "^0.19.7",
1718
"lodash.debounce": "^4.0.8",
1819
"prismjs": "^1.16.0",

src/utils/getAst.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
import { parse } from "acorn";
1+
var acorn = require("acorn");
2+
var jsx = require("acorn-jsx");
23

34
export default function getAst(code) {
4-
return parse(code, {
5+
return acorn.Parser.extend(jsx()).parse(code, {
56
ecmaVersion: 2019,
67
sourceType: "module"
78
});

0 commit comments

Comments
 (0)