11/**
2- * Copyright (c) 2020-2024 , WSO2 LLC. (https://www.wso2.com).
2+ * Copyright (c) 2020-2026 , WSO2 LLC. (https://www.wso2.com).
33 *
44 * WSO2 LLC. licenses this file to you under the Apache License,
55 * Version 2.0 (the "License"); you may not use this file except
@@ -29,6 +29,7 @@ import GlobalVariablesProvider from "@wso2is/admin.core.v1/providers/global-vari
2929import { store } from "@wso2is/admin.core.v1/store" ;
3030import OrganizationsProvider from "@wso2is/admin.organizations.v1/providers/organizations-provider" ;
3131import { ContextUtils } from "@wso2is/core/utils" ;
32+ import * as monaco from "monaco-editor" ;
3233import React , { ReactElement , useEffect , useState } from "react" ;
3334import * as ReactDOM from "react-dom" ;
3435import { Provider } from "react-redux" ;
@@ -39,36 +40,8 @@ import Theme from "./theme";
3940// Set the runtime config in the context.
4041ContextUtils . setRuntimeConfig ( Config . getDeploymentConfig ( ) ) ;
4142
42- /**
43- * TODO: Use Monaco with the webpack plugin.
44- * {@link https://github.com/wso2-enterprise/asgardeo-product/issues/23937}
45- *
46- * Function to check the status of the Monaco CDN.
47- * If the CDN is not available, the default CDN will be used.
48- */
49- const checkCDNStatus = async ( ) => {
50- try {
51- const response : Response = await fetch ( "https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/min/vs/loader.js" ) ;
52-
53- if ( response . ok ) {
54- loader . config ( {
55- paths : {
56- vs : "https://cdn.jsdelivr.net/npm/monaco-editor@0.36.1/min/vs"
57- }
58- } ) ;
59- } else {
60- loader . config ( {
61- paths : {
62- vs : "https://cdnjs.cloudflare.com/ajax/libs/monaco-editor/0.36.1/min/vs"
63- }
64- } ) ;
65- }
66- } catch ( error ) {
67- // Use default CDN.
68- }
69- } ;
70-
71- checkCDNStatus ( ) ;
43+ // Configure monaco editor.
44+ loader . config ( { monaco : monaco as any } ) ;
7245
7346/**
7447 * Render root component with configs.
0 commit comments