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

引用pako这个库之后编译的时候报错 #4963

Open
Lazybin opened this issue Jun 5, 2024 · 4 comments
Open

引用pako这个库之后编译的时候报错 #4963

Lazybin opened this issue Jun 5, 2024 · 4 comments

Comments

@Lazybin
Copy link

Lazybin commented Jun 5, 2024

用了有pako依赖的包。
编译运行的时候报这个错误:
[plugin:commonjs--resolver] Unbalanced delimiter found in string

参考了:
#4524
对esbuildPrePlugin.js进行了修改,编译h5可以通过,但是编译app又会报这个错

@Otto-J
Copy link
Member

Otto-J commented Jun 6, 2024

嗯,这个问题似曾相识,是 pako 这个用到了 #ifdef xxx ,但是没有 endif 导致的对吧。

@Lazybin
Copy link
Author

Lazybin commented Jun 7, 2024

嗯,这个问题似曾相识,是 pako 这个用到了 #ifdef xxx ,但是没有 endif 导致的对吧。

我发现是pako包里有类似这样的注释

/*#ifdef NO_INIT_GLOBAL_POINTERS
  static_l_desc.static_tree = static_ltree;
  static_l_desc.extra_bits = extra_lbits;
  static_d_desc.static_tree = static_dtree;
  static_d_desc.extra_bits = extra_dbits;
  static_bl_desc.extra_bits = extra_blbits;
#endif*/

我修改成

//修改后
//#ifdef NO_INIT_GLOBAL_POINTERS
  static_l_desc.static_tree = static_ltree;
  static_l_desc.extra_bits = extra_lbits;
  static_d_desc.static_tree = static_dtree;
  static_d_desc.extra_bits = extra_dbits;
  static_bl_desc.extra_bits = extra_blbits;
//#endif

就可以了

@Otto-J
Copy link
Member

Otto-J commented Jun 7, 2024

link #4524

@Otto-J
Copy link
Member

Otto-J commented Jun 7, 2024

清提供一个复现问题的单页面代码或者工程吧,我尝试修复下

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

No branches or pull requests

2 participants