@gotoeasy/browserify

    0.4.3 • Public • Published

    @gotoeasy/browserify

    使用固定配置让browserify转译代码,简化满足特定需求:把含require的代码转成能在浏览器上运行的代码

    NPM version License

    Sample

    const browserify = require('@gotoeasy/browserify');
    
    let code = `
    "use strict";
    
    require("core-js/modules/es6.string.starts-with");
    
    var flg = 'abc'.startsWith('a');
    `;
    
    (async function(){
        let rs = await browserify(code, './'); // 在当前目录查找补丁模块
        console.info(rs);
    })();
    
    
    
    // 转译结果如下
    /*
    (function(){function r(e,n,t)...
       ...
       ...
       ...
    },{"./_export":9,"./_fails-is-regexp":10,"./_string-context":23,"./_to-length":25}],30:[function(require,module,exports){
    
    "use strict";
    
    require("core-js/modules/es6.string.starts-with");
    
    var flg = 'abc'.startsWith('a');
    
    },{"core-js/modules/es6.string.starts-with":29}]},{},[30]);
    */

    Links

    Install

    npm i @gotoeasy/browserify

    DownloadsWeekly Downloads

    2

    Version

    0.4.3

    License

    MIT

    Unpacked Size

    3.72 kB

    Total Files

    4

    Last publish

    Collaborators

    • rpose