@@ -21,14 +21,12 @@ import ReactGA from 'react-ga4'
21
21
import * as monaco from 'monaco-editor/esm/vs/editor/editor.api'
22
22
import { configureMonacoYaml } from 'monaco-yaml'
23
23
24
- import editorWorker from 'monaco-editor/esm/vs/editor/editor.worker?worker'
25
24
import { ReactComponent as Info } from '../../Assets/Icon/ic-info-filled.svg'
26
25
import { ReactComponent as ErrorIcon } from '../../Assets/Icon/ic-error-exclamation.svg'
27
26
import { ReactComponent as WarningIcon } from '../../Assets/Icon/ic-warning.svg'
28
27
import './codeEditor.scss'
29
28
import 'monaco-editor'
30
29
31
- import YamlWorker from '../../yaml.worker.js?worker'
32
30
import { YAMLStringify , cleanKubeManifest , useJsonYaml } from '../Helper'
33
31
import { useWindowSize } from '../Hooks'
34
32
import Select from '../Select/Select'
@@ -48,10 +46,18 @@ import { MODES } from '../Constants'
48
46
49
47
self . MonacoEnvironment = {
50
48
getWorker ( _ , label ) {
49
+ const getWorkerModule = ( moduleUrl : string ) => {
50
+ return new Worker ( self . MonacoEnvironment . getWorkerUrl ( moduleUrl , label ) , {
51
+ name : label ,
52
+ type : 'module' ,
53
+ } )
54
+ }
55
+
51
56
if ( label === MODES . YAML ) {
52
- return new YamlWorker ( )
57
+ return getWorkerModule ( '../../yaml.worker.js?worker' )
53
58
}
54
- return new editorWorker ( )
59
+
60
+ return getWorkerModule ( '/monaco-editor/esm/vs/editor/editor.worker?worker' )
55
61
} ,
56
62
}
57
63
@@ -73,7 +79,7 @@ function useCodeEditorContext() {
73
79
* Thus as a hack we are using this objects reference to call the latest onChange reference
74
80
*/
75
81
const _onChange = {
76
- onChange : null
82
+ onChange : null ,
77
83
}
78
84
79
85
const CodeEditor : React . FC < CodeEditorInterface > & CodeEditorComposition = React . memo (
0 commit comments