[英]ES6 — importing of es5 files
I try to use this ( https://github.com/gocardless/es6-angularjs/blob/master/README.md ) as a starting point and then include the bootstrap javascript code. 我尝试使用此( https://github.com/gocardless/es6-angularjs/blob/master/README.md )作为起点,然后包含bootstrap javascript代码。 In order to open a modal 为了打开一个模态
But the only thing that happens is: 但唯一发生的事情是:
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)
I added this to the main.js: 我把它添加到main.js:
import 'bootstrap-js';
//TODO please explain to me why not working
and this to the loader.config.js file: 这到loader.config.js文件:
System.config({
meta: {
...,
'components/bootstrap/dist/js':{ format: 'global', export: 'bootstrap'}
},
map: {
....,
'bootstrap-js': 'components/bootstrap/dist/js'
}
});
exports
instead of export
here: 在这里尝试exports
而不是export
: System.config({
meta: {
//...
'components/bootstrap/dist/js':{ format: 'global', exports: 'bootstrap'}
}
//...
});
{ format: 'global', exports: 'bootstrap'}
you're trying to get global bootstrap
variable. 当你写{ format: 'global', exports: 'bootstrap'}
你正试图获得全局bootstrap
变量。 But such does not exists. 但这种情况并不存在。 So I think you must remove meta line and fix map. 所以我认为你必须删除元线和修复地图。 Result must be look like: 结果必须如下所示: 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'
}
});
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.