通过babel分析AST,然后删除注释 几个关键步骤点 这个visitor里面的方法是有顺序的 vistor: { entry(path):{}, // 节点名称 VariableDeclaration(path){}, CallExpression(path){}, exit(path){} } sourcemap存储为字符串 fs.writeFileSync('./build/index.js.map', JSON.stringify(output.map));