From 35875f88236e27cb54e5c86465fd00a6846174cd Mon Sep 17 00:00:00 2001 From: Santiago Jimenez Giraldo Date: Wed, 16 Oct 2024 13:44:00 +0200 Subject: [PATCH] wip(frontend): validate yaml loading make sure auth is also included in the proxy config Signed-off-by: Santiago Jimenez Giraldo --- frontend/rsbuild.config.ts | 4 +++- frontend/src/config.ts | 22 ++++++++++++++++++---- 2 files changed, 21 insertions(+), 5 deletions(-) diff --git a/frontend/rsbuild.config.ts b/frontend/rsbuild.config.ts index 421cb2d26..eab24c266 100644 --- a/frontend/rsbuild.config.ts +++ b/frontend/rsbuild.config.ts @@ -5,7 +5,7 @@ import { pluginSvgr } from '@rsbuild/plugin-svgr'; import { pluginSass } from '@rsbuild/plugin-sass'; import NodePolyfillPlugin from 'node-polyfill-webpack-plugin'; import { RsdoctorRspackPlugin } from '@rsdoctor/rspack-plugin'; -import MonacoEditorWebpackPlugin from 'monaco-editor-webpack-plugin'; +// import MonacoEditorWebpackPlugin from 'monaco-editor-webpack-plugin' import moduleFederationConfig from './module-federation'; @@ -66,6 +66,8 @@ export default defineConfig({ config.resolve.symlinks = false; config.output.publicPath = 'auto'; + config.output.globalObject = 'self'; + config.output.filename = '[name].bundle.js'; const plugins = [ new NodePolyfillPlugin({ diff --git a/frontend/src/config.ts b/frontend/src/config.ts index afb102fa8..b674af245 100644 --- a/frontend/src/config.ts +++ b/frontend/src/config.ts @@ -212,18 +212,32 @@ export const setup = memoizeOne((setupArgs: SetConfigArguments) => { // Ensure yaml workers are being loaded locally as well loader.init().then(async (monaco) => { + // eslint-disable-next-line no-restricted-globals window.MonacoEnvironment = { getWorker(moduleId, label) { console.debug(`window.MonacoEnvironment.getWorker looking for moduleId ${moduleId} label ${label}`); + switch (label) { - case 'editorWorkerService': - return new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker', import.meta.url)); + case 'json': + return new Worker(new URL('monaco-editor/esm/vs/language/json/json.worker', import.meta.url)); + case 'typescript': + case 'javascript': + return new Worker(new URL('monaco-editor/esm/vs/language/typescript/ts.worker', import.meta.url)); case 'yaml': return new Worker(new URL('monaco-yaml/yaml.worker', import.meta.url)); - default: - throw new Error(`Unknown label ${label}`); + return new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker', import.meta.url)); } + + // switch (label) { + // case 'editorWorkerService': + // return new Worker(new URL('monaco-editor/esm/vs/editor/editor.worker', import.meta.url)); + // case 'yaml': + // return new Worker(new URL('monaco-yaml/yaml.worker', import.meta.url)); + // + // default: + // throw new Error(`Unknown label ${label}`); + // } }, };