由于项目范围的原因,我试图在旧版本的浏览器中运行我的。应用程序在最新版本和Chrome中运行良好。IE10和似乎存在问题(火狐版本< 50 )。我正在运行我的应用程序,目前的48.0.1,我得到了一个简单的线性问题,在控制台上读。
TypeError:这是未定义的,仅此而已。
我试图谷歌,并发现了一个类似的git枢纽问题。
这是我找到的关闭解决方案。https://github.com/angular/angular-cli/issues/9340
我试图遵循与插件相关的问题,并将其移到以前的版本1.1.5。我也尝试过这些命令。
npm i uglifyjs-webpack-plugin@1.1.5 --save-exact
rm -rf package-lock.json node_modules
npm install现在的问题是,我仍然可以在包-lock.json文件中看到一些其他版本的1.2.5和0.4.6。我手动删除了,但仍然没有解决方案。
package.json
"dependencies": {
...
"uglifyjs-webpack-plugin": "1.1.5",
}package-lock.json
"@angular/cli": {
"dependencies": {
"requires": {
...
"uglifyjs-webpack-plugin": "1.2.5",
}
"uglifyjs-webpack-plugin": {
"version": "1.2.5",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.2.5.tgz",
"integrity": "sha512-hIQJ1yxAPhEA2yW/i7Fr+SXZVMp+VEI3d42RTHBgQd2yhp/1UdBcR3QEWPV5ahBxlqQDMEMTuTEvDHSFINfwSw==",
"dev": true,
"requires": {
"cacache": "10.0.4",
"find-cache-dir": "1.0.0",
"schema-utils": "0.4.5",
"serialize-javascript": "1.5.0",
"source-map": "0.6.1",
"uglify-es": "3.3.9",
"webpack-sources": "1.1.0",
"worker-farm": "1.6.0"
},
"dependencies": {
"source-map": {
"version": "0.6.1",
"resolved": "https://registry.npmjs.org/source-map/-/source-map-0.6.1.tgz",
"integrity": "sha512-UjgapumWlbMhkBgzT7Ykc5YXUT46F0iKu8SGXq0bcwP5dz/h0Plj6enJqjz1Zbq2l5WaqYnrVbwWOWMyF3F47g==",
"dev": true
}
}
}
....
"uglifyjs-webpack-plugin": {
"version": "1.1.5",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-1.1.5.tgz",
"integrity": "sha512-YBGc9G7dv12Vjx8vUQs54DZgAXVf04LlG6dNNiEbTZjL3PbUqiY4uPB9Kv+fUJaqRskEGva/lS7sh08yJr7jnA==",
"requires": {
"cacache": "10.0.4",
"find-cache-dir": "1.0.0",
"schema-utils": "0.3.0",
"serialize-javascript": "1.5.0",
"source-map": "0.6.1",
"uglify-es": "3.2.2",
"webpack-sources": "1.1.0",
"worker-farm": "1.6.0"
}
},
"webpack": {
"requires": {
"uglifyjs-webpack-plugin": "0.4.6",
}
"dependencies": {
"uglifyjs-webpack-plugin": {
"version": "0.4.6",
"resolved": "https://registry.npmjs.org/uglifyjs-webpack-plugin/-/uglifyjs-webpack-plugin-0.4.6.tgz",
"integrity": "sha1-uVH0q7a9YX5m9j64kUmOORdj4wk=",
"dev": true,
"requires": {
"source-map": "0.5.7",
"uglify-js": "2.8.29",
"webpack-sources": "1.1.0"
}
},
}
}
}
}任何我能得到的想法或帮助。这对项目来说是个关键问题。
提前谢谢。
发布于 2018-05-23 08:29:52
我找到了一个解决办法。
只是加--aot假就行了。
我使用的是命令ng serve -prod --aot=false,它的工作原理类似于魅力。
但有没有人知道它是否安全?我也发现了github的讨论。
https://github.com/angular/angular-cli/issues/9244
https://github.com/angular/angular/issues/21631
对这一问题的任何更新或正确的回答都将受到高度推荐。
谢谢,
https://stackoverflow.com/questions/50480892
复制相似问题