Can system.js replace require.js

后端 未结 2 1391
生来不讨喜
生来不讨喜 2021-02-13 22:47

I\'m using requirejs in a large project. This project will soon be upgraded to angular2.

Angular2 uses system.js, so I\'m thinking of switching to system.js too. Should

相关标签:
2条回答
  • 2021-02-13 23:22

    I just switched to system.js too. You need to replace your require.js with system.js and add simple script tag. So it should look like this:

    <script src="~/lib/system.js/dist/system.js" type="text/javascript"></script>
    <script>  
        // set our baseURL reference path
        System.config({
            baseURL: '/app'
        });
        System.import('startup.js');
    </script>
    
    0 讨论(0)
  • 2021-02-13 23:31

    in addition to above steps set

    System.defaultJSExtensions = true;

    by default systemjs is not adding extension .js

    0 讨论(0)
提交回复
热议问题