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

[BUG] Vite 5.2.0下 导入BrowserModule异常 #55

Open
lixin131 opened this issue Apr 3, 2024 · 4 comments
Open

[BUG] Vite 5.2.0下 导入BrowserModule异常 #55

lixin131 opened this issue Apr 3, 2024 · 4 comments
Labels

Comments

@lixin131
Copy link

lixin131 commented Apr 3, 2024

描述你的问题(Describe the bug)

创建了一个模块提供给AppRenderer组件使用,编辑器下相关模块引入无异常。但是在浏览器下报错显示文件没有导出BrowserModule,不知道问题出在哪,还请帮忙解惑。
code1
code2
code3

复现路径(To Reproduce)

预期表现(Expected behavior)

环境信息(Environment)

  • OS: [e.g. macOS 11.2 Apple M1/Windows10/Windows11]
  • Browser: [e.g. chrome, safari, electron]
  • Codeblitz Version: [e.g. 1.0.0]
@bytemain
Copy link
Member

bytemain commented Apr 7, 2024

直接从模块包中导入试试

import { IEventBus, BrowserModule, Domain, ClientAppContribution, Disposable } from '@opensumi/ide-core-browser';

@lixin131
Copy link
Author

通过@opensumi/ide-core-browser包引用资源的话,浏览器又会报: Uncaught ReferenceError: process is not defined。

@bytemain
Copy link
Member

这个应该是 opensumi 代码的问题,你先试试加一个 process 的 polyfill

@lixin131
Copy link
Author

加了polyfill,也都直接调用@opensumi/xxx特定的一些模块。然后写自定义的扩展模块放在AppRenderer,又报Cannot find Provider of xxxx。去@opensumi那里查询说是引用不同版本的@opensumi/di库导致的。

我修改成import { Injectable } from "@codeblitzjs/ide-core/lib/modules/opensumi__common-di"; 这样的导入,浏览器又会提示找不到相应的导出。

我复制opensumi文档档的例子代码就没成功过。如果可以,是否能提供一个基于vite创建的且能添加自定义模块Demo项目地址,因为仓库提供的都是基于webpack的环境,我技术太差确定不了到底是哪出了问题......, 很抱歉。

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

No branches or pull requests

2 participants