angularjs – Angular 2(4),Webpack站点将无法在IE 11中的服务器
在角度或webpack中是否有一些特殊的IE开关,因为当我在
http://localhost:port/上运行我的网站时,它可以工作.此外,当我在Edge或Chrome上的服务器
http://server.domain/mysite/上运行它时,它可以工作.但是当我在IE 11上打开它(兼容模式设置为11)时,我在控制台中收到以下错误:
未处理的Promise拒绝:无法加载函数t(t){var e = this; this.http = t,this.getItems = function(){e.results = null,e.http.get(“api / app / components /my-items.component.html; Zone :;任务:Promise.then;值:无法加载函数t(t){var e = this; this.http = t,this.getItems = function(){e. results = null,e.http.get(“api / app / components / my-items.component.html undefined 对我来说意味着什么的唯一部分是’api /’是完全错误的,并且我已经仔细检查了组件,它清楚地说: @Component({ selector: 'my-items',templateUrl: 'app/components/my-items.component.html' }) export class MyItemsComponent implements OnInit { ... 整个解决方案中没有出现短语’api / app'(包括c#,ts,css,html和js文件) 我的webpack.config.js很简单: /// <binding ProjectOpened='Watch - Development' /> var path = require('path'); var webpack = require('webpack'); var console = require('console'); module.exports = { context: path.join(__dirname,'wwwroot'),//vendor: ['libs/@angular/platform-browser-dynamic/bundles/platform-browser-dynamic.umd.js'],entry: './app/main.js',output: { path: path.join(__dirname,'wwwroot/built'),filename: '[name].bundle.js',},plugins: [ //new webpack.optimize.CommonsChunkPlugin("vendor","vendor.bundle.js"),// split vendor js into its own file new webpack.optimize.CommonsChunkPlugin({ name: 'vendor',minChunks: function (module,count) { // any required modules inside node_modules are extracted to vendor var path = module.resource.replace(//g,'/'); return (/.js$/.test(path) && (path.indexOf('node_modules/') >= 0 || path.indexOf('libs/') >= 0)); } }; 这里发生了什么? 解决方法
我使用2.0.0-rc.1和webpack遇到了同样的问题.在阅读了一些
issues之后,我的解决方案是在浏览器是IE时在我的index.html上包含以下脚本:
es6-shim.min.js system-polyfills.js shims_for_IE.js 前两个可以在node_modules中找到,我从here下载了第三个. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
- vim命令
- Angular2 Observable BehaviorSubject服务不起作用
- scala – 如何将for循环Seq输出重写为Stream输出?
- angularjs – Angular JS:为什么module.config注入和控制器
- webservice 服务器未能识别 HTTP 头 SOAPAction 的值
- AngularJs路由:ngRoute
- angularjs – 如何将变量注入指令的范围?
- 防止MSYS的bash’杀死陷阱^ C的进程
- twitter-bootstrap – Bootstrap ScrollSpy似乎打破了Boots
- 【Bootstrap3.0建站笔记一】表单元素排版