// vite.monaco-editor.js
export default function monacoEditorPlugin() {
  return {
    name: 'monaco-editor-plugin',
    config(config) {
      config.define = {
        ...config.define,
        'process.platform': JSON.stringify('darwin'),
        'process.env': {},
      };
    },
    configureServer(server) {
      return () => {
        server.middlewares.use('/_monaco', (req, res) => {
          res.setHeader('Cross-Origin-Resource-Policy', 'cross-origin');
        });
      };
    }
  };
}
