fix: monaco require (#1404)
Co-authored-by: sealday <sealday@gmail.com> Reviewed-on: daoyoucloud/tachybase#1404
This commit is contained in:
parent
c80060b00e
commit
363f592ebb
@ -33,7 +33,7 @@ import { WebSocketClient, WebSocketClientOptions } from './WebSocketClient';
|
||||
|
||||
declare global {
|
||||
interface Window {
|
||||
tbDefine: RequireJS['define'];
|
||||
define: RequireJS['define'];
|
||||
}
|
||||
}
|
||||
|
||||
@ -132,7 +132,8 @@ export class Application {
|
||||
private initRequireJs() {
|
||||
this.requirejs = getRequireJs();
|
||||
defineGlobalDeps(this.requirejs);
|
||||
window.tbDefine = this.requirejs.define;
|
||||
window.define = this.requirejs.define;
|
||||
window.require = this.requirejs.require;
|
||||
}
|
||||
|
||||
private addDefaultProviders() {
|
||||
|
@ -8,7 +8,7 @@ import type { RequireJS } from './requirejs';
|
||||
*/
|
||||
export function defineDevPlugins(plugins: Record<string, typeof Plugin>) {
|
||||
Object.entries(plugins).forEach(([packageName, plugin]) => {
|
||||
window.tbDefine(`${packageName}/client`, () => plugin);
|
||||
window.define(`${packageName}/client`, () => plugin);
|
||||
});
|
||||
}
|
||||
|
||||
@ -16,7 +16,7 @@ export function defineDevPlugins(plugins: Record<string, typeof Plugin>) {
|
||||
* @internal
|
||||
*/
|
||||
export function definePluginClient(packageName: string) {
|
||||
window.tbDefine(`${packageName}/client`, ['exports', packageName], function (_exports: any, _pluginExports: any) {
|
||||
window.define(`${packageName}/client`, ['exports', packageName], function (_exports: any, _pluginExports: any) {
|
||||
Object.defineProperty(_exports, '__esModule', {
|
||||
value: true,
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user