Angular 无效的正则表达式范围在字符类中顺序错误

Angular 无效的正则表达式范围在字符类中顺序错误,angular,Angular,运行Angular应用程序时,出现以下错误: 无效的正则表达式:/[^ šŽ€-Š€]/:字符类中的范围无序 导致错误的最小代码行是: /** * @license * Copyright Google Inc. All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://a

运行Angular应用程序时,出现以下错误:

无效的正则表达式:/[^ šŽ€-Š€]/:字符类中的范围无序

导致错误的最小代码行是:

/**
 * @license
 * Copyright Google Inc. All Rights Reserved.
 *
 * Use of this source code is governed by an MIT-style license that can be
 * found in the LICENSE file at https://angular.io/license
 */var ec="ngPreserveWhitespaces",tc=new Set(["pre","template","textarea","script","style"]),nc=" \f\n\r\t\váš€á Žâ€€- \u2028\u2029 âŸã€€\ufeff",rc=new RegExp("[^"+nc+"]"),ic=n.....
这段代码来自Angular,那么为什么它会导致运行时错误呢


注意:使用Angular 6.0时,问题是javascript文件被下载为ASCII。解决方案是告诉浏览器将文件解释为UTF-8。在HTML文件中,有两种方法可以执行此操作:

将字符集全局设置为UTF-8:

<head>
    <meta charset="utf-8" />
</head>
或者仅对一个文件使用UTF-8:

<script src="lib.min.js" charset="utf-8"></script>

我选择了第一个选项。

我选择了第二个选项-在使用webpack JS捆绑包时,我面临同样的问题。