Angular8でIE11が表示させたい
他の方の解決策を参考に試しましたが、以下のコンソールエラーを解決できずIE11が表示できないです。
必要な情報、足りない点あればお手数ですがご指摘お願いいたします。
発生している問題・エラーメッセージ
IE11 開発者ツールのコンソール
SCRIPT1002: 構文エラーです。 polyfills.js (3048,5) SCRIPT1002: 構文エラーです。 vendor.js (155,1) SCRIPT1002: 構文エラーです。 main.js (93,24)
試したこと
以下のファイルを編集、作成して最後にコマンドを実行しました。
version
Node:12.3.1
OS:win32 x64
Angular:8.1.1
browserslist
IE 9-11 # For IE 9-11 support, remove 'not'.
polyfills.ts
import 'classlist.js'; import 'web-animations-js';
tsconfig.json
targetを"es2015"から変更
{ "compileOnSave": false, "compilerOptions": { "baseUrl": "./", "outDir": "./dist/out-tsc", "sourceMap": true, "declaration": false, "downlevelIteration": true, "experimentalDecorators": true, "module": "esnext", "moduleResolution": "node", "importHelpers": true, "target": "es5", "typeRoots": ["node_modules/@types"], "types": ["node"], "paths": { "@/*": ["src/*"] }, "lib": ["es2018", "dom"] }, "angularCompilerOptions": { "fullTemplateTypeCheck": true, "strictInjectionParameters": true } }
angular.json
”es5”部分を追加
"build": { "builder": "@angular-devkit/build-angular:browser", "options": { ... }, "configurations": { "production": { ... }, "es5": { "tsConfig": "./tsconfig-es5.app.json" } } }, "serve": { "builder": "@angular-devkit/build-angular:dev-server", "options": { ... }, "configurations": { "production": { ... }, "es5": { "browserTarget": "project名:build:es5" } } },
tsconfig-es5.app.json
このファイルは新規作成して、tsconfig.jsonと同じ階層に追加
{ "extends": "./tsconfig.app.json", "compilerOptions": { "target": "es5" } }
コマンドを実行
ng serve --configuration es5
あなたの回答
tips
プレビュー