ES6 -- 导入 es5 文件
ES6 -- importing of es5 files
我尝试使用这个(https://github.com/gocardless/es6-angularjs/blob/master/README.md)作为起点,然后包含引导JavaScript代码。为了打开模态
但唯一发生的是:
Potentially unhandled rejection [3] Error loading "components/bootstrap/dist/js" at http://localhost:3010/components/bootstrap/dist/js.js
Error loading "components/bootstrap/dist/js" from "app-compiled/bootstrap" at http://localhost:3010/app-compiled/bootstrap.js
Not Found: http://localhost:3010/components/bootstrap/dist/js.js (WARNING: non-Error used)
我将其添加到主.js:
import 'bootstrap-js';
//TODO please explain to me why not working
这个到loader.config.js文件:
System.config({
meta: {
...,
'components/bootstrap/dist/js':{ format: 'global', export: 'bootstrap'}
},
map: {
....,
'bootstrap-js': 'components/bootstrap/dist/js'
}
});
- 尝试
exports
而不是在此处export
:
System.config({
meta: {
//...
'components/bootstrap/dist/js':{ format: 'global', exports: 'bootstrap'}
}
//...
});
- 当您写入
{ format: 'global', exports: 'bootstrap'}
时,您正在尝试获取全局bootstrap
变量。但这种情况并不存在。所以我认为你必须删除元线并修复地图。结果必须如下所示:
System.config({
meta: {
//...
'components/path/to/jquery': { format: 'global', exports: 'jQuery' },
'components/bootstrap/dist/js/bootstrap': { deps: ['jquery'] }
}
map: {
//...
'jquery': 'components/path/to/jquery',
'bootstrap-js': 'components/bootstrap/dist/js/bootstrap'
}
});
相关文章:
- 如何播放部分音频文件
- 从桌面读取python文件时高亮显示代码
- 使用JS如何动态更改显示的html文件中的文本背景颜色
- 如何使用WCF服务和javascript表单post上传.doc文件
- 当包含另一个asp文件时,是否也包含所有引用的样式和脚本页面
- 如何在生成下载文件时显示加载动画
- 有没有任何方法可以将控制器从文件加载到ui路由器$stateProvider中
- Javascript-如何读取json文件中的列并将其保存在Javascript数组中
- 将jsp文件下拉列表中的选定项分配给一个java变量(比如String selection)
- 正在SharePoint 2013母版页中添加JQuery移动文件
- 如何在php文件中获取$.post-ajax传递的值
- 直接下载文件,而不是从window.open(url)
- 如何在android中使用phonegap将文件从一个文件夹移动/复制到另一个文件夹
- 使用压缩的JavaScript文件(不是运行时压缩)
- 在使用Polymer'加载所有json文件后执行方法;s的核心ajax
- 如何在elfinder插件(一个文件管理器插件)上获得上传前事件
- Javascript运行php文件,然后下载文件
- 节点Js:How to catch a“;没有这样的文件或目录“;读取线模块出错
- ES6 -- 导入 es5 文件
- 为什么浏览器需要一个polyfills文件,而我用babel编译ES6到ES5