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

在 vite 中使用的问题 #75

Closed
yangshenggirl opened this issue May 19, 2022 · 10 comments
Closed

在 vite 中使用的问题 #75

yangshenggirl opened this issue May 19, 2022 · 10 comments
Assignees

Comments

@yangshenggirl
Copy link

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. ...
  2. ...

Expected behavior
A clear and concise description of what you expected to happen.

Node or Browser version (please complete the following information):

  • Browser [e.g. chrome72.0.3626.121]
  • Node [e.g. v8.9.4]

Package links for testing(downloadable links of the package, which making this issue)

描述 bug
请简明扼要的描述你所遇到的bug

复现
请描述复现该bug的步骤:

  1. ...
  2. ...

预期表现
请简明扼要的描述你所期望得到的效果

请填写您的Node或浏览器版本:

  • Browser [如:chrome72.0.3626.121]
  • Node [如:v8.9.4]

请提供测试用的安装包下载链接:

@HeidaLay
Copy link

请问你解决了吗 我也是在vite环境中无法自动解析ipa文件 么得办法让手动填写了

@yangshenggirl
Copy link
Author

yangshenggirl commented May 26, 2022 via email

@chenquincy
Copy link
Owner

@yangshenggirl @HeidaLay vite 还没有去适配过,不过看起来应该是打包的问题导致的,更优解是暂时采用 cdn 的方式去引入 app-info-parser。

@chenquincy
Copy link
Owner

chenquincy commented May 26, 2022

可以用 unpkg 的 cdn 先试试: https://unpkg.com/browse/app-info-parser@1.1.3/dist/app-info-parser.min.js 。引入后直接使用全局变量 AppInfoParser 即可。

@yangshenggirl
Copy link
Author

yangshenggirl commented May 26, 2022 via email

@yangshenggirl
Copy link
Author

vite的编译使用的是另外一个开源的包rollup,开发时dev server是不会去使用cdn的代码的,只会引用我们安装的node_modules内部的代码,所以引入cdn之后使用AppInfoParser 会失败

@arrosev
Copy link

arrosev commented Aug 7, 2022

我在node环境下解析没问题,在浏览器下解析ipa同样报“Buffer is not defined”,我看了下用的plist库的源码,https://github.com/TooTallNate/plist.js/blob/0a322c3918c7c0dc3d8ec36b3da98048b9b7dde3/lib/parse.js 这个文件第207行用了Buffer,我拷贝了它的源码,然后在浏览器环境(我的项目是用vite2和vue3搭建的)把Buffer类型改成uint8array就不会报错了

@chenquincy
Copy link
Owner

@yangshenggirl @arrosev 不好意思忘记跟进了,可以的话麻烦提供个最小的复现 demo,我看一下

@arrosev
Copy link

arrosev commented Aug 8, 2022

@yangshenggirl @arrosev 不好意思忘记跟进了,可以的话麻烦提供个最小的复现 demo,我看一下

demo: https://github.com/arrosev/TestFilePod

@chenquincy
Copy link
Owner

@arrosev vite 并没有支持 node 环境的打算,可以参考这个 issue 里我的回复,我也没办法去让所有的依赖库提供 esm 的构建产物,因此使用 vite 的时候不要用 import 的方式使用 app-info-parser,直接使用 script 标签引入 cdn 文件,然后使用 window.AppInfoParser 来解析。

@chenquincy chenquincy changed the title 1.vite里无法使用require引入app-info-parser,不过可以通过添加‘vite-plugin-require-transform'支持 2.但是尽管引入了插件,在解析ipa文件时,没有内置Buffer,会出现解析失败的问题 在 vite 中使用的问题 Aug 9, 2022
@chenquincy chenquincy pinned this issue Aug 9, 2022
@chenquincy chenquincy closed this as not planned Won't fix, can't repro, duplicate, stale Aug 9, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants