繁体   English   中英

从bower_components加载systemjs

[英]Load systemjs from bower_components

我用凉亭安装了systemjs。 我已成功将其加载到我的网站中,但是在system-config.js中,我发现未定义SystemJS错误。 为什么?

 <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));

您可能犯了与尝试重现该错误时相同的错误。

您使用以下命令安装了SystemJS:

bower install systemjs

这不是您要查找的库。

转到https://bower.io/search/并搜索systemjs。 你会发现第一个包裹说

带有用户系统信息的JavaScript对象。

实际的包名为system.js,而不是systemjs

在安装命令中添加一个点。

bower install system.js

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM