Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] monaco editor 升级至 0.53.0 版本 #4028

Open
Ricbet opened this issue Sep 18, 2024 · 11 comments · May be fixed by #4227
Open

[FEATURE] monaco editor 升级至 0.53.0 版本 #4028

Ricbet opened this issue Sep 18, 2024 · 11 comments · May be fixed by #4227
Assignees
Labels
🎨 feature feature required

Comments

@Ricbet
Copy link
Member

Ricbet commented Sep 18, 2024

如果你的需求与问题相关,请在下面描述一下(Is your feature request related to a problem? Please describe.)

描述你预期的功能表现(Describe the solution you'd like)

描述你考虑过的替代方案(Describe alternatives you've considered)

补充信息(Additional context)

@Ricbet Ricbet added the 🎨 feature feature required label Sep 18, 2024
@Ricbet Ricbet self-assigned this Sep 18, 2024
@Ricbet Ricbet changed the title [FEATURE] monaco editor 升级至 0.51.0 版本 [FEATURE] monaco editor 升级至 0.52.0 版本 Sep 27, 2024
@Ricbet
Copy link
Member Author

Ricbet commented Sep 27, 2024

@Ricbet Ricbet changed the title [FEATURE] monaco editor 升级至 0.52.0 版本 [FEATURE] monaco editor 升级至 0.53.0 版本 Dec 11, 2024
@Ricbet
Copy link
Member Author

Ricbet commented Dec 11, 2024

由于 monaco 0.53 还未发版。需要自己基于 vscode 最新的 1.95 版本构建出 0.53.0-dev 的 monaco 版本

@Ricbet
Copy link
Member Author

Ricbet commented Dec 11, 2024

相关 pr:opensumi/monaco-editor-core#21

@Ricbet
Copy link
Member Author

Ricbet commented Dec 11, 2024

待解决的问题

  • nls
  • esm 模块问题
  • 集成验证

@Ricbet
Copy link
Member Author

Ricbet commented Dec 13, 2024

问题记录:

image

monaco 现在都是编译成 esm 文件了,而我们现在还是编译成 commonjs,导致插件进程依赖 monaco 的一些 base 文件运行失败

image

正常来说插件进程文件是不应该依赖 monaco 的,这块需要进行调整


@Ricbet
Copy link
Member Author

Ricbet commented Dec 17, 2024

问题探索:

以往的 monaco 版本中都有对功能模块 hack 的部分,这部分是否能放在 OpenSumi 里通过 override 的方式去 hack,仅保留编译部分的改动?

@Ricbet
Copy link
Member Author

Ricbet commented Dec 18, 2024

问题记录:

编译 worker 文件时报以下错误
image

翻看源码,发现是通过动态 import 加载的某个 js 文件

const url = FileAccess.asBrowserUri(`${moduleId}.js` as AppResourcePath).toString(true);
return import(`${url}`).then((module: { create: IRequestHandlerFactory }) => {
	this._requestHandler = module.create(this);

	if (!this._requestHandler) {
		throw new Error(`No RequestHandler!`);
	}
});

在经过我们编译成 bundle 后成了这个样子
image

导致文件加载错误

@Ricbet
Copy link
Member Author

Ricbet commented Dec 18, 2024

修正:
../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/worker lazy recursive ^.*$ 路径本身没有问题,这是 webpack 为了支持动态导入而生成的一个特殊标识符。

有问题的是这段
image

map 列表多了一些 d.ts 和 map 文件,导致加载这些文件时产生了报错


@Ricbet
Copy link
Member Author

Ricbet commented Dec 19, 2024

问题记录:

diff 文件打不开

image


@Ricbet Ricbet linked a pull request Dec 19, 2024 that will close this issue
1 task
@coderabbitai coderabbitai bot linked a pull request Dec 19, 2024 that will close this issue
1 task
@Ricbet
Copy link
Member Author

Ricbet commented Dec 20, 2024

问题记录:

业务方在集成时启动失败
image

@Ricbet
Copy link
Member Author

Ricbet commented Dec 20, 2024

修正: ../../node_modules/@opensumi/monaco-editor-core/esm/vs/base/common/worker lazy recursive ^.*$ 路径本身没有问题,这是 webpack 为了支持动态导入而生成的一个特殊标识符。

有问题的是这段 image

map 列表多了一些 d.ts 和 map 文件,导致加载这些文件时产生了报错

已解决,在动态 import 当中添加特殊注释即可,这样就能避免无关文件被打包

/* webpackInclude: /\.js$/ */

见文档:https://webpack.docschina.org/api/module-methods/#dynamic-expressions-in-import

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🎨 feature feature required
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant