Package Manager: Bower vs jspm

后端 未结 2 1520
一整个雨季
一整个雨季 2021-01-30 00:08

How is Bower different than jspm? Can Bower provide jspm functionality about SystemJS universal module loader?

2条回答
  •  余生分开走
    2021-01-30 00:21

    To add on to Capaj's answer:

    If you have a small project, go with jspm anyway! It's the future! (who knows, things change, but this is a good bet).

    Small project use:

    $ jspm install jquery
    

    then in your HTML:

        
        
        
    

    then in main.js:

    import $ from 'jquery'; // ES6-style import
    // do whatever with jQuery here.
    

    You can use CommonJS, AMD, or ES 6 module formats. JSPM auto-detects them in your files (you can't mix and match in the same file though).

    var $ = require('jquery'); // CommonJS-style import
    // do whatever with jQuery here.
    
    define(['jquery'], function($) { // AMD-style import
        // do whatever with jQuery here.
    })
    

提交回复
热议问题