fix: inline CJS module/exports shims in client bundle for browser loader
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
window.__ModuleLoader__.load({ id: "@gyxx/dsh-plugin-gyxx-workbench", factory: (require) => {
|
window.__ModuleLoader__.load({ id: "@gyxx/dsh-plugin-gyxx-workbench", factory: (require) => {
|
||||||
|
var module = { exports: {} };
|
||||||
|
var exports = module.exports;
|
||||||
var __defProp = Object.defineProperty;
|
var __defProp = Object.defineProperty;
|
||||||
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
||||||
var __getOwnPropNames = Object.getOwnPropertyNames;
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
||||||
|
|||||||
File diff suppressed because one or more lines are too long
@@ -40,7 +40,9 @@ await build({
|
|||||||
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),
|
'process.env.NODE_ENV': JSON.stringify(process.env.NODE_ENV ?? 'production'),
|
||||||
},
|
},
|
||||||
banner: {
|
banner: {
|
||||||
js: `window.__ModuleLoader__.load({ id: ${JSON.stringify(PKG_ID)}, factory: (require) => {`,
|
// dsh 浏览器加载器只给 factory 传 require(返回值即模块导出),
|
||||||
|
// CJS 的 module/exports 垫片必须由包体自带(与官方 tsdown 产物一致)。
|
||||||
|
js: `window.__ModuleLoader__.load({ id: ${JSON.stringify(PKG_ID)}, factory: (require) => {\nvar module = { exports: {} };\nvar exports = module.exports;`,
|
||||||
},
|
},
|
||||||
footer: { js: 'return module.exports; } });' },
|
footer: { js: 'return module.exports; } });' },
|
||||||
logLevel: 'info',
|
logLevel: 'info',
|
||||||
|
|||||||
Reference in New Issue
Block a user