标签: javascript babeljs
我使用6to5编译ES6代码片段,但在编译时会出现ReferenceError: unknown: Line 1: Top level this is undefined in strict mode错误。
ReferenceError: unknown: Line 1: Top level this is undefined in strict mode
var to5 = require('6to5'); to5.transform('this.x = 42').code
错误有意义,但我想编译引用this的代码段,有没有办法抑制错误并继续编译?
this