RequireJS relative paths

前端 未结 2 1609
清歌不尽
清歌不尽 2020-12-23 10:15

I\'m new to RequireJS. I\'m writing a number of custom bindings in Knockout.js and want to split them up using modules.

The layout of my code at the moment is:

2条回答
  •  清歌不尽
    2020-12-23 10:40

    Use "packages" in require config. Here the valid answer for you question topic

    require.config({
    packages: [
    { 
        name: 'packagename',
        location: 'path/to/your/package/root',  // default 'packagename'
        main: 'scriptfileToLoad'                // default 'main' 
    }]
       ... some other stuff ...
    });
    

    Inside of package you will be able to use relative paths.

提交回复
热议问题