Angular アプリをバージョン 12 にアップグレードしました。mathjax 以外はすべて動作します。実行するng serve
と、以下のエラーが表示されます
Error: mathjax/es5/sre/mathmaps/de.js from Terser
Unexpected token: punc (:) [mathjax/es5/sre/mathmaps/de.js:2,19]
at js_error (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:550:11)
at croak (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:1274:9)
at token_error (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:1282:9)
at unexpected (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:1288:9)
at semicolon (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:1326:56)
at simple_statement (c:\path\to\pro1jectnode_modules\terser\dist\bundle.min.js:1583:73)
at statement (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:1369:47)
at _embed_tokens_wrapper (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:1339:26)
at block_ (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:2172:20)
at statement (c:\path\to\pro1ject\node_modules\terser\dist\bundle.min.js:1403:29)
SyntaxError: Unexpected token: punc ())のようないくつかの質問は、パッケージ ファイルに無効な文字があることを示しています。以下は、mathjax/es5/sre/mathmaps/de.js:2,19 です。
{
"fr/si/prefixes.js": <--Error Occurs Here
[{"Y":"yotta","Z":"zetta","E":"exa","P":"péta","T":"téra","G":"giga","M":"méga","k":"kilo","h":"hecto","da":"déca","d":"déci","c":"centi","m":"milli","µ":"micro","μ":"micro","n":"nano","p":"pico","f":"femto","a":"atto","z":"zepto","y":"yocto"}]
,
"fr/functions/algebra.js":
[{"locale":"fr"},{"category":"Algebra","mappings":{"default":{"default":"degré"}},"key":"deg","names":["deg"]},{"category":"Algebra","mappings":{"default":{"default":"déterminant"}},"key":"det","names":["det"]},{"category":"Algebra","mappings":{"default":{"default":"dimension"}},"key":"dim","names":["dim"]},{"category":"Algebra","mappings":{"default":{"default":"homomorphisme"}},"key":"hom","names":["hom","Hom"]},{"category":"Algebra","mappings":{"default":{"default":"noyau"}},"key":"ker","names":["ker"]},{"category":"Algebra","mappings":{"default":{"default":"trace"}},"key":"Tr","names":["Tr","tr"]}]
,
"fr/functions/elementary.js":
[{"locale":"fr"},{"key":"log","mappings":{"default":{"default":"log"}},"category":"Logarithm","names":["log"]},{"key":"ln","mappings":{"default":{"default":"logarithme népérien"}},"category":"Logarithm","names":["ln"]},{"key":"lg","names":["lg"],"mappings":{"default":{"default":"logarithme décimal"}},"category":"Logarithm"},{"key":"exp","names":["exp","expt"],"mappings":{"default":{"default":"exponentielle"}},"category":"Elementary"},{"key":"gcd","names":["gcd","PGCD","pgcd"],"mappings":{"default":{"default":"plus grand commun diviseur"},"mathspeak":{"default":"pgcd"},"clearspeak":{"default":"pgcd"}},"category":"Elementary"},{"key":"lcm","names":["lcm","ppcm","PPCM","PPMC","ppmc"],"mappings":{"default":{"default":"plus petit commun multiple"},"mathspeak":{"default":"ppcm"},"clearspeak":{"default":"ppcm"}},"category":"Elementary"},{"key":"arg","names":["arg"],"mappings":{"default":{"default":"argument"}},"category":"Complex"},{"key":"im","names":["im"],"mappings":{"default":{"default":"partie imaginaire"}},"category":"Complex"},{"key":"re","names":["re"],"mappings":{"default":{"default":"partie réelle"}},"category":"Complex"},{"key":"inf","names":["inf"],"mappings":{"default":{"default":"borne inférieure"}},"category":"Limits"},{"key":"lim","mappings":{"default":{"default":"limite"}},"category":"Limits","names":["lim"]},{"key":"max","names":["max"],"mappings":{"default":{"default":"maximum"}},"category":"Limits"},{"key":"min","names":["min"],"mappings":{"default":{"default":"minimum"}},"category":"Limits"},{"key":"sup","names":["sup"],"mappings":{"default":{"default":"borne supérieure"}},"category":"Limits"},{"key":"lim inf","names":["lim inf","liminf"],"mappings":{"default":{"default":"limite inferior"}},"category":"Limits"},{"key":"lim sup","names":["lim sup","limsup"],"mappings":{"default":{"default":"limite superior"}},"category":"Limits"},{"key":"injlim","names":["injlim","inj lim"],"mappings":{"default":{"default":"limite inductive"}},"category":"Limits"},{"key":"projlim","names":["projlim","proj lim"],"mappings":{"default":{"default":"limite projective"}},"category":"Limits"},{"key":"mod","names":["mod"],"mappings":{"default":{"default":"modulo"}},"category":"Elementary"},{"key":"Pr","names":["Pr"],"mappings":{"default":{"default":"probabilité"}},"category":"Probability"}]
,
"fr/functions/hyperbolic.js":
[{"locale":"fr"},{"key":"cosh","mappings":{"default":{"default":"cosinus hyperbolique"}},"category":"Hyperbolic","names":["cosh"]},{"key":"coth","mappings":{"default":{"default":"cotangente hyperbolique"}},"category":"Hyperbolic","names":["coth"]},{"key":"csch","mappings":{"default":{"default":"cosécante hyperbolique"}},"category":"Hyperbolic","names":["csch"]},{"key":"sech","mappings":{"default":{"default":"sécante hyperbolique"}},"category":"Hyperbolic","names":["sech"]},{"key":"sinh","mappings":{"default":{"default":"sinus hyperbolique"}},"category":"Hyperbolic","names":["sinh"]},{"key":"tanh","mappings":{"default":{"default":"tangente hyperbolique"}},"category":"Hyperbolic","names":["tanh"]},{"category":"Area","mappings":{"default":{"default":"argument cosinus hyperbolique"}},"key":"arcosh","names":["arcosh","arccosh","argch"]},{"category":"Area","mappings":{"default":{"default":"argument cotangente hyperbolique"}},"key":"arcoth","names":["arcoth","arccoth","argcoth"]},{"category":"Area","mappings":{"default":{"default":"argument cosécante hyperbolique"}},"key":"arcsch","names":["arcsch","arccsch","argcsch"]},{"category":"Area","mappings":{"default":{"default":"argument sécante hyperbolique"}},"key":"arsech","names":["arsech","arcsech","argsech"]},{"category":"Area","mappings":{"default":{"default":"argument sinus hyperbolique"}},"key":"arsinh","names":["arsinh","arcsinh","argsh"]},{"category":"Area","mappings":{"default":{"default":"argument tangente hyperbolique"}},"key":"artanh","names":["artanh","arctanh","argth"]}]
,
...
}
このエラーを解決するにはどうすればよいですか? このエラーが発生するのは 6 つの異なるファイルから約 130 行あるため、ファイルを変更することは実行可能な解決策ではない可能性があります。
ビルドはAngular 11で正常に機能していました
以下は私のeslint
設定ファイルです
{
"root": true,
"ignorePatterns": [
"projects/**/*"
],
"parserOptions": {
"ecmaVersion": 2015
},
"env": {
"es6": true
},
"overrides": [
{
"files": [
"*.ts"
],
"parserOptions": {
"project": [
"tsconfig.json",
"e2e/tsconfig.json"
],
"createDefaultProgram": true
},
"extends": [
"plugin:@angular-eslint/ng-cli-compat",
"plugin:@angular-eslint/ng-cli-compat--formatting-add-on",
"plugin:@angular-eslint/template/process-inline-templates"
],
"rules": {
"@angular-eslint/component-selector": [
"error",
{
"type": "element",
"prefix": "app",
"style": "kebab-case"
}
],
"@angular-eslint/directive-selector": [
"error",
{
"type": "attribute",
"prefix": "app",
"style": "camelCase"
}
],
"@typescript-eslint/explicit-member-accessibility": [
"off",
{
"accessibility": "explicit"
}
],
"arrow-parens": [
"off",
"always"
],
"import/order": "off"
}
},
{
"files": [
"*.html"
],
"extends": [
"plugin:@angular-eslint/template/recommended"
],
"rules": {}
}
]
}