标签:source tput 输出 打开 join code 笔记 通过 dev
emitFile() { // 打包输出的路径 let main = path.join(this.config.output.path, this.config.output.filename) console.log(main, ‘test‘) this.assets = {} // let templateStr = this.getSource(path.join(__dirname, ‘main.ejs‘)); let code = ejs.render(templateStr, { entryId: this.entryId, modules: this.modules }) //路径对应的代码 this.assets[main] = code; fs.writeFileSync(main, this.assets[main]) }
(function(modules) { var installedModules = {}; function __webpack_require__(moduleId) { if(installedModules[moduleId]) { return installedModules[moduleId].exports; } var module = installedModules[moduleId] = { i: moduleId, l: false, exports: {} }; modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); module.l = true; return module.exports; } return __webpack_require__(__webpack_require__.s = "<%-entryId%>"); }) /* 自执行函数 传入参数 */ ({ <%for(let key in modules){%> "<%-key%>": (function(module, exports, __webpack_require__) { eval(`<%-modules[key]%>`); }), <%}%> });
标签:source tput 输出 打开 join code 笔记 通过 dev
原文地址:https://www.cnblogs.com/guangzhou11/p/12543068.html