RequireJS: loading different files according environment

前端 未结 2 1370
终归单人心
终归单人心 2021-01-05 17:05

Is there any functionality to load different files according on current project environment (development or production for example)? I mean something, that helps me transpar

2条回答
  •  孤城傲影
    2021-01-05 17:32

    If someone still want to know how to do that:

    require.config({
        paths: {
            'jquery' : (function(){
                if( MODE == 'DEV' ){
                    return 'jquery';
                }else{
                    return 'jquery.min'
                }
            })()
        }
    });
    

    This function is self invoking anonymous function. It invokes immediately in the definition place.

提交回复
热议问题