thu-info-community / thu-info-lib

The JavaScript library that provides a program-friendly interface to Tsinghua web portal
MIT License
27 stars 5 forks source link

[help wanted] How to implement this lib's feature into other platforms, for example, WeChat miniApp? #58

Closed LC0117 closed 2 years ago

LC0117 commented 2 years ago

I am trying to develop a WeChat mini-program with some features like ThuInfo. However, I ran into some problems when I try to use this lib. The output is as follow.

1

And my code to import this lib:

const thuInfo = require('thu-info-lib')

I am wondering if the error is caused by my code or this lib.

UNIDY2002 commented 2 years ago

I'm not familiar with WeChat mini-program, but I guess this issue is caused by the import syntax of the lib, which might be incompatible with the compiler of WeChat mini-program. Modifying the value of field module in tsconfig.json from "esnext" to "CommonJS" and then re-generating the lib with yarn build might help solve the problem. I will test whether this modification maintains backward compatibility and consider making a new release recently.

UNIDY2002 commented 2 years ago

Update: I've made a release using commonjs import syntax, and if you are still interested in integrating into miniApp, you can try thu-info-lib@1.3.5 or thu-info-lib@2.0.0-alpha.10 :)

LC0117 commented 2 years ago

Danke! I’ll try it out when I get free.