简体   繁体   English

Babel 配置“严格模式”

[英]Babel Config "strict mode"

For some strange reason I can't for the life of me compile "vendor" libraries with my build process.由于某些奇怪的原因,我终生无法用我的构建过程编译“供应商”库。

Im getting this error: SyntaxError: <FILENAME> 'with' in strict mode .我收到此错误: SyntaxError: <FILENAME> 'with' in strict mode

(where <FILENAME> is an actual existing filename) (其中<FILENAME>是实际存在的文件名)

The line that's failing is > 130928 | with (locals || {}) { (function(){失败的线路是> 130928 | with (locals || {}) { (function(){ > 130928 | with (locals || {}) { (function(){ and its complaining about that with . Bear in mind that this file is outside my control. > 130928 | with (locals || {}) { (function(){和它的抱怨with 。记住这个文件不在我的控制范围内。

My .babelrc file has this config.我的.babelrc文件有这个配置。

{
    "compact": true,
    "plugins": [
        "transform-runtime",
        "undeclared-variables-check"
    ],
    "presets": [
        "es2015",
        "stage-0"
    ]
}

I'm using babel 6, I know the general conscious is to use version 5, but no luck there either.我正在使用 babel 6,我知道一般有意识的是使用版本 5,但也没有运气。

Not sure why this hasn't been answered already.不知道为什么这还没有得到回答。

The es2015 preset (and, to my understanding, every babel preset) enables strict mode. es2015 预设(以及,据我所知,每个 babel 预设)启用严格模式。 Check out MDN's article on strict mode , specifically the section with header "Simplifying variable uses".查看MDN 关于严格模式的文章,特别是标题为“简化变量使用”的部分。 with is illegal in strict mode. with在严格模式下是非法的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Eslint 在使用 babel 解析器时禁用严格模式 - Eslint disable strict mode when using babel parser 使用Gulp-babel并在严格模式下获得“参数名称冲突” - Using Gulp-babel and getting “Argument name clash in strict mode” 禁用/忽略用于转译 JavaScript 文件的 Babel 严格模式 - Disable/Ignore Babel strict mode for transpiling javascript files Node js抛出关于严格模式的错误,尽管将babel 6预设es2015与包含严格模式一起使用 - Node js throw error about strict mode although using babel 6 preset es2015 with contains strict mode Webpack配置不在严格模式下,不想更改代码 - Webpack config not in strict mode, don't want to change the code babel-loader:模块构建失败:SyntaxError:在严格模式下删除局部变量 - babel-loader: Module build failed: SyntaxError: Deleting local variable in strict mode Babel / Karma / Chai给出TypeError:严格模式函数可能无法访问&#39;caller&#39;,&#39;callee&#39;和&#39;arguments&#39;属性 - Babel / Karma / Chai gives TypeError: 'caller', 'callee', and 'arguments' properties may not be accessed on strict mode functions 如何将Angular UI路由器配置为不使用严格的URL匹配模式 - How to config Angular ui-router to not use strict URL matching mode 操作员在严格模式下更换“with” - Operator replacement “with” in strict mode 在严格模式下删除HTMLElement - delete HTMLElement in strict mode
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM