From f3f687ab92b2f35018432c403476b9ee363071cc Mon Sep 17 00:00:00 2001 From: "qingyi.xjh" Date: Fri, 20 Dec 2024 16:58:35 +0800 Subject: [PATCH] fix: monaco dynamic import bundle --- packages/monaco/package.json | 2 +- packages/monaco/webpack.config.js | 8 -------- tools/dev-tool/package.json | 1 - tools/dev-tool/src/webpack.js | 13 +------------ yarn.lock | 18 +++++------------- 5 files changed, 7 insertions(+), 35 deletions(-) diff --git a/packages/monaco/package.json b/packages/monaco/package.json index cd984c4d6c..cad5dd5014 100644 --- a/packages/monaco/package.json +++ b/packages/monaco/package.json @@ -21,7 +21,7 @@ "@opensumi/ide-overlay": "workspace:*", "@opensumi/ide-theme": "workspace:*", "@opensumi/ide-utils": "workspace:*", - "@opensumi/monaco-editor-core": "0.53.0-patch.1" + "@opensumi/monaco-editor-core": "0.53.0-patch.2" }, "devDependencies": { "@opensumi/ide-dev-tool": "workspace:*", diff --git a/packages/monaco/webpack.config.js b/packages/monaco/webpack.config.js index 7814929d9e..c0a1ec2b62 100644 --- a/packages/monaco/webpack.config.js +++ b/packages/monaco/webpack.config.js @@ -33,13 +33,5 @@ module.exports = { maxChunks: 1, }), ], - module: { - rules: [ - { - test: /\.d\.ts$|\.js\.map$/, - use: 'ignore-loader', - }, - ], - }, stats: process.env.CI ? 'errors-only' : 'normal', }; diff --git a/tools/dev-tool/package.json b/tools/dev-tool/package.json index 829e21c6cb..4de51f398e 100644 --- a/tools/dev-tool/package.json +++ b/tools/dev-tool/package.json @@ -19,7 +19,6 @@ "css-loader": "^6.9.1", "fork-ts-checker-webpack-plugin": "^9.0.2", "html-webpack-plugin": "^5.6.0", - "ignore-loader": "^0.1.2", "koa": "^2.15.0", "koa-bodyparser": "^4.3.0", "koa-router": "^12.0.1", diff --git a/tools/dev-tool/src/webpack.js b/tools/dev-tool/src/webpack.js index 78536525d4..8d844e78cc 100644 --- a/tools/dev-tool/src/webpack.js +++ b/tools/dev-tool/src/webpack.js @@ -99,7 +99,7 @@ exports.createWebpackConfig = function (dir, entry, extraConfig) { }, { test: /\.tsx?$/, - exclude: [notebookModulePath, /\.d\.ts$|\.js\.map$/], + exclude: [notebookModulePath], use: [ { loader: 'ts-loader', @@ -180,17 +180,6 @@ exports.createWebpackConfig = function (dir, entry, extraConfig) { filename: 'fonts/[name][hash:8][ext][query]', }, }, - { - /** - * monaco 从 0.53 版本开始已经全面编译成 esm 模块,其中有使用动态 import 的导入 - * 而我们将其进行编译时会把动态 import 的所有文件连同不同的后缀名(例如 .d.ts 和 .js.map)等都进行了 require 导入,从而导包错误 - * 具体可以搜索 bundle.js 文件里带有 webpackAsyncContext 的部分 - * - * 目前还不知道怎么剔除这些 .d.ts 和 .js.map 的生成,只能在这个地方先进行 ignore - */ - test: /\.d\.ts$|\.js\.map$/, - use: 'ignore-loader', - }, ], }, resolveLoader: { diff --git a/yarn.lock b/yarn.lock index 5e42f7070f..8736f785ad 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3497,7 +3497,6 @@ __metadata: css-loader: "npm:^6.9.1" fork-ts-checker-webpack-plugin: "npm:^9.0.2" html-webpack-plugin: "npm:^5.6.0" - ignore-loader: "npm:^0.1.2" koa: "npm:^2.15.0" koa-bodyparser: "npm:^4.3.0" koa-router: "npm:^12.0.1" @@ -3854,7 +3853,7 @@ __metadata: "@opensumi/ide-theme": "workspace:*" "@opensumi/ide-utils": "workspace:*" "@opensumi/ide-workspace": "workspace:*" - "@opensumi/monaco-editor-core": "npm:0.53.0-patch.1" + "@opensumi/monaco-editor-core": "npm:0.53.0-patch.2" languageName: unknown linkType: soft @@ -4320,10 +4319,10 @@ __metadata: languageName: node linkType: hard -"@opensumi/monaco-editor-core@npm:0.53.0-patch.1": - version: 0.53.0-patch.1 - resolution: "@opensumi/monaco-editor-core@npm:0.53.0-patch.1" - checksum: 10/560da2c02fba76d87de2267cf2539c1dd0c1ad398ca483ebe9e9aa8cea3b346251d75e2604ca298142a613181b859a9b6c5d0b18ce2e145b3b60e7dc960dee87 +"@opensumi/monaco-editor-core@npm:0.53.0-patch.2": + version: 0.53.0-patch.2 + resolution: "@opensumi/monaco-editor-core@npm:0.53.0-patch.2" + checksum: 10/e5ebd5c3bb8fada9341cf9c023283ed5cd3e9b1bc01e1bf74a7d12e688947994572292e6ffcd352126be37a738a435650b289270dc71abcd42b0363176245d2f languageName: node linkType: hard @@ -13521,13 +13520,6 @@ __metadata: languageName: node linkType: hard -"ignore-loader@npm:^0.1.2": - version: 0.1.2 - resolution: "ignore-loader@npm:0.1.2" - checksum: 10/26b5f81b24e59c575d5314e1416c4ae21fb88e65b3c60c90581288ef925fcaa2b39e7f8f96cd449e488c217337d5240fba5a916f9aec073ec04495d7a5716ac4 - languageName: node - linkType: hard - "ignore-walk@npm:^5.0.1": version: 5.0.1 resolution: "ignore-walk@npm:5.0.1"