Skip to content

Commit

Permalink
wip(frontend): validate yaml loading
Browse files Browse the repository at this point in the history
make sure auth is also included in the proxy config

Signed-off-by: Santiago Jimenez Giraldo <[email protected]>
  • Loading branch information
sago2k8 committed Oct 16, 2024
1 parent 946cb81 commit 35875f8
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
4 changes: 3 additions & 1 deletion frontend/rsbuild.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';

Expand Down Expand Up @@ -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({
Expand Down
22 changes: 18 additions & 4 deletions frontend/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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}`);
// }
},
};

Expand Down

0 comments on commit 35875f8

Please sign in to comment.