Javascript Create react应用程序未将abab模块编译为ES5兼容代码,导致IE11出现故障
有人知道为什么使用TS并配置为生成代码的create react应用程序项目无法在IE11上运行,因为“abab”包中的“atob”未编译为符合ES5的代码:Javascript Create react应用程序未将abab模块编译为ES5兼容代码,导致IE11出现故障,javascript,typescript,internet-explorer,webpack,ecmascript-5,Javascript,Typescript,Internet Explorer,Webpack,Ecmascript 5,有人知道为什么使用TS并配置为生成代码的create react应用程序项目无法在IE11上运行,因为“abab”包中的“atob”未编译为符合ES5的代码: module.exports = { atob, // SCRIPT1003: Expected ':' btoa }; tsconfig.json: { "compilerOptions": { "baseUrl": ".", "outDir": "build/dist", "module": "e
module.exports = {
atob, // SCRIPT1003: Expected ':'
btoa
};
tsconfig.json:
{
"compilerOptions": {
"baseUrl": ".",
"outDir": "build/dist",
"module": "esnext",
"target": "es5",
"lib": ["es6", "dom", "esnext.asynciterable" ],
"sourceMap": true,
"allowJs": true,
"jsx": "react",
"moduleResolution": "node",
"rootDir": "src",
"forceConsistentCasingInFileNames": true,
"noImplicitReturns": true,
"noImplicitThis": true,
"noImplicitAny": true,
"strictNullChecks": true,
"suppressImplicitAnyIndexErrors": true,
"noUnusedLocals": false,
"removeComments": false,
"strict": true,
"alwaysStrict": true,
"noUnusedParameters": true,
"allowSyntheticDefaultImports": true,
"downlevelIteration": true
},
"include": [
"src/**/*"
],
"exclude": [
"build",
"node_modules"
]
}
>npm-ls-abab
project@0.1.0 E:\project
-- jest@22.4.2
-- jest-cli@22.4.4
-- jest-environment-jsdom@22.4.3
-- jsdom@11.12.0
-- abab@2.0.0 deduped
-- jest-runner@22.4.4
-- jest-config@22.4.4
-- jest-environment-jsdom@22.4.3
-- jsdom@11.12.0
-- abab@2.0.0 deduped
-- jsdom@12.0.0
-- abab@2.0.0
-- data-urls@1.0.1
-- abab@2.0.0 deduped
编辑:
可在此处找到网页包配置:
编辑2:问题不是webpack或atob,而是abab导致的问题,项目的构建在其他地方声称存在语法错误。此问题已通过删除domprify的用法得到解决,domprify需要JSDOM,这需要abab软件包。您的网页包配置在哪里?@FrankerZ项目不会被弹出。当您说“使用TS”时,您的意思是使用
--scripts version=react scripts TS
?@FrankerZ请忽略之前关于项目不会被弹出的声明。请参阅使用ts加载程序编辑,请参阅编辑网页包配置