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

exports 中添加 types 并没有实质性解决问题,使用中仍然会报错 #178

Closed
oevery opened this issue Jun 13, 2024 · 3 comments
Labels
bug Something isn't working released

Comments

@oevery
Copy link
Contributor

oevery commented Jun 13, 2024

          今天在使用中发现上次并没有从根源上解决问题,虽然不会报找不到声明文件的错了,但是使用中会提示
[worker reload] [worker init] The requested module 'socks-proxy-agent' does not provide an export named 'SocksProxyAgent'                             

  import { SocksProxyAgent } from 'socks-proxy-agent';
  ^^^^^^^^^^^^^^^
  SyntaxError: The requested module 'socks-proxy-agent' does not provide an export named 'SocksProxyAgent'

测试发现只要更改 proxy agent 的引入方式:

import HttpsProxyAgent from 'https-proxy-agent';
import SocksProxyAgent from 'socks-proxy-agent';

或者删除掉 package.json 中的 exports 字段即可解决问题。

不太清除这两种解决方案会不会带来新的问题,甚至有点弄不清为啥会出现这么奇怪的问题,所以放上来看看。

Originally posted by @oevery in #144 (comment)

@CaoMeiYouRen
Copy link
Owner

如果可以的话,麻烦给一个最小的可复现问题的demo。

我推测原因可能是 socks-proxy-agenthttps-proxy-agent 的版本问题。

由于历史原因,push-all-in-one 的兼容性选择了 node >= 12,在未来的大版本更新中,可能会对 socks-proxy-agenthttps-proxy-agent 进行更新。

@CaoMeiYouRen CaoMeiYouRen added the bug Something isn't working label Jun 13, 2024
@CaoMeiYouRen
Copy link
Owner

CaoMeiYouRen commented Jun 13, 2024

如果可以的话,麻烦给一个最小的可复现问题的demo。

我推测原因可能是 socks-proxy-agenthttps-proxy-agent 的版本问题。

由于历史原因,push-all-in-one 的兼容性选择了 node >= 12,在未来的大版本更新中,可能会对 socks-proxy-agenthttps-proxy-agent 进行更新。

更正:应该是设置了 package.jsontypemodule

经过测试在 typemodule 的时候会出现上述问题,在 typecommonjs 或不设置的时候没有问题。

该问题会在后续版本修复

CaoMeiYouRen pushed a commit that referenced this issue Jun 13, 2024
## [3.5.3](v3.5.2...v3.5.3) (2024-06-13)

### 🐛 Bug 修复

* 修复:在 esm 模式下, https-proxy-agent/socks-proxy-agent 的导入错误问题 ([eb68501](eb68501)), closes [#178](#178)
@CaoMeiYouRen
Copy link
Owner

🎉 This issue has been resolved in version 3.5.3 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working released
Projects
None yet
Development

No branches or pull requests

2 participants