我使用babel-loader的webpack一个自定义巴贝尔,插件改造一些第三方代码,这样通过的WebPack的捆绑,但不在麻烦的格式。但是,当我的代码通过 babel 的解析器 (babylon) 运行以构建 AST 时,出现以下错误:
Module build failed: SyntaxError: Deleting local variable in strict mode
我在 bablyon 中找到了触发此消息的行:https : //github.com/babel/babylon/blob/master/src/parser/expression.js#L236
看着这些代码,好像我应该能够在巴比伦禁用严格模式解析通过设置this.state.strict来false。问题是我不知道如何this.state.strict从babel-loader. 我希望其他人对此有更多了解。
以下是我迄今为止尝试过的一些事情:
strict: false并strictMode: false在query
{
test: /\.js$/,
include: /bower_components/, //only thirdparty
loader: 'babel',
query: {
strict: false,
plugins: [__dirname + '/babel-plugins/custom-plugin']
}
}
Run Code Online (Sandbox Code Playgroud)strict: false并strictMode: false带有插件
{
test: /\.js$/,
include: /bower_components/, //only thirdparty
loader: 'babel',
query: …Run Code Online (Sandbox Code Playgroud)