ast babeljs
作者:互联网
安装包
cnpm install @babel/parser cnpm install @babel/traverse cnpm install @babel/types cnpm install @babel/generator
@babel/parser 将js代码转换成ast
@babel/traverse 遍历ast中的节点
@babel/types 判断节点类型和生成新的节点等
@babel/generator 把ast转换成js
const parser = require("@babel/parser"); const traverse = require("@babel/traverse").default; const generator = require("@babel/generator").default; const types = require("@babel/types"); console.log("test");
标签:traverse,const,cnpm,generator,ast,babel,parser,babeljs 来源: https://www.cnblogs.com/angdh/p/14383826.html