RequireJS does not run data-main script before loading required modules

后端 未结 3 1758
慢半拍i
慢半拍i 2021-01-07 02:07

My project includes the following files:

./index.html
./js/main.js
./js/vendor/require.js
./js/viewmodel/vm.js

The index.html

3条回答
  •  滥情空心
    2021-01-07 02:32

    to use the data-main attribute for configuring your whole application, it is necessary that it is the single entry point for all your code.

    your 2nd script block breaks this requirement by providing a 2nd entry point. since these entry points will resolve independently of each other (and asynchronously), you cannot rely on one to affect the other.

    to resolve it, refactor your code in a way that provides a single entry point to your application and do your configuration via this entry point.

提交回复
热议问题