[英]Load systemjs from bower_components
I installed systemjs with bower. 我用凉亭安装了systemjs。 I successfully load it in my website, but in system-config.js, I get mistake SystemJS is not defined. 我已成功将其加载到我的网站中,但是在system-config.js中,我发现未定义SystemJS错误。 Why? 为什么?
<script src="./bower_components/systemjs/build/system.min.js"></script>
<script src="./scripts/system-config.js"></script>
SystemJS.config({
transpiler: 'plugin-babel',
map: {
//system transpiler
'plugin-babel': './bower_components/systemjs-plugin-babel/plugin-babel.js',
'systemjs-babel-build': './bower_components/systemjs-plugin-babel/systemjs-babel-browser.js',
//app scripts
'main': './scripts/main.js',
'requester': './scripts/requester.js',
'templates': './scripts/templates.js',
'data': './scripts/data.js',
//controllers
'home': '../controllers/home.js',
'login-form': '../controllers/login-form.js',
//js libraries
'jquery': './bower_components/jquery/dist/jquery.js',
'navigo': './bower_components/navigo/lib/navigo.min.js',
'handlebars': './bower_components/handlebars/dist/handlebars.js',
}
});
SystemJS.import('./scripts/main.js').then(x => console.log(x), x => console.log(x));
You probably made the same mistake I made when trying to reproduce the error. 您可能犯了与尝试重现该错误时相同的错误。
You installed SystemJS with the command: 您使用以下命令安装了SystemJS:
bower install systemjs
This is not the Library you are looking for. 这不是您要查找的库。
Go to https://bower.io/search/ and search for systemjs. 转到https://bower.io/search/并搜索systemjs。 You will find the first package saying 你会发现第一个包裹说
JavaScript object with the user's system information. 带有用户系统信息的JavaScript对象。
The real package is named system.js and not systemjs 实际的包名为system.js,而不是systemjs
add a dot to the install command. 在安装命令中添加一个点。
bower install system.js
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.