Open Rain120 opened 2 years ago
var LIB =
(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__("./test.js");
})
({
"./test.js":
(function (module, exports) {
eval("console.log('test');\n\n//# sourceURL=webpack://LIB/./test.js?");
})
});
export default LIB;
export { LIB };
思考点
伪代码
https://q.shanyue.tech/engineering/753.html
实现: https://github.com/wessberg/cjstoesm
Rollup 插件
@rollup/plugin-commonjs
babel-plugin-transform-commonjs
CDN
https://cdn.skypack.dev/
https://jspm.org/