Skip to content

Commit

Permalink
fix: monaco dynamic import bundle
Browse files Browse the repository at this point in the history
  • Loading branch information
Ricbet committed Dec 20, 2024
1 parent 2371609 commit f3f687a
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 35 deletions.
2 changes: 1 addition & 1 deletion packages/monaco/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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:*",
Expand Down
8 changes: 0 additions & 8 deletions packages/monaco/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -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',
};
1 change: 0 additions & 1 deletion tools/dev-tool/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
13 changes: 1 addition & 12 deletions tools/dev-tool/src/webpack.js
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ exports.createWebpackConfig = function (dir, entry, extraConfig) {
},
{
test: /\.tsx?$/,
exclude: [notebookModulePath, /\.d\.ts$|\.js\.map$/],
exclude: [notebookModulePath],
use: [
{
loader: 'ts-loader',
Expand Down Expand Up @@ -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: {
Expand Down
18 changes: 5 additions & 13 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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

Expand Down Expand Up @@ -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"
Expand Down

0 comments on commit f3f687a

Please sign in to comment.