From 1608b8da1bcac32c58eec301d40032e75404a0b3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20Gorej?= Date: Mon, 25 Mar 2024 13:55:06 +0100 Subject: [PATCH] build(webpack): use custom build monaco-editor (#36) Refs https://github.com/swagger-api/swagger-editor/issues/4848 --- package-lock.json | 2 +- packages/react-scripts/config/webpack.config.js | 5 +++++ packages/react-scripts/package.json | 2 +- 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/package-lock.json b/package-lock.json index ea3e7290..17ca90b8 100644 --- a/package-lock.json +++ b/package-lock.json @@ -32466,7 +32466,7 @@ "peerDependencies": { "buffer": "^6.0.3", "https-browserify": "^1.0.0", - "monaco-editor": ">= 0.44.0", + "monaco-editor": "npm:@codingame/monaco-vscode-editor-api", "process": "^0.11.10", "react": ">= 16", "stream-browserify": "^3.0.0", diff --git a/packages/react-scripts/config/webpack.config.js b/packages/react-scripts/config/webpack.config.js index 3eb95da2..f071fc47 100644 --- a/packages/react-scripts/config/webpack.config.js +++ b/packages/react-scripts/config/webpack.config.js @@ -859,6 +859,11 @@ module.exports = function (webpackEnv) { process: 'process/browser.js', Buffer: ['buffer', 'Buffer'], }), + new webpack.BannerPlugin({ + banner: "globalThis.vscode = { process: Symbol.for('vscode') };", + raw: true, // This is important, it tells webpack to prepend the code as-is. + entryOnly: true, // This adds the banner only to the beginning of the bundle. + }), enableProgressPlugin && new webpack.ProgressPlugin({ activeModules: false, diff --git a/packages/react-scripts/package.json b/packages/react-scripts/package.json index 371fe1f3..6a71573d 100644 --- a/packages/react-scripts/package.json +++ b/packages/react-scripts/package.json @@ -95,7 +95,7 @@ "buffer": "^6.0.3", "react": ">= 16", "typescript": "^3.2.1 || ^4", - "monaco-editor": ">= 0.44.0", + "monaco-editor": "npm:@codingame/monaco-vscode-editor-api", "stream-browserify": "^3.0.0", "stream-http": "^3.2.0", "url": ">=0.11.2"