uniapp(vue3) - The WeChat applet platform uses import to import external js files and appears undefined, and the normal import js files (sdk plug-in) file path is correct, but the console.log console prints undefined

Problem Description

Note: uniapp applet platform!

During the process of importing the SDK using the uniapp WeChat applet, you may encounter such a situation:
when using console.log() to print the name of the imported module, the actual output name is not the name you expected. This is because after uniapp is compiled and packaged, the code will be renamed to reduce file size and improve execution efficiency, including modifying variable names, method names, module names, etc.

  • uniapp vue2.xIntroduce external js (sdk) files through import, normal
  • uniapp vue3.xIntroduce external js (sdk) files through import, and report undefined error

The version of uniapp vue2 is fine, but vue3 is not.

insert image description here

insert image description here

Solution

When using uniapp to introduce third-party libraries or modules

Guess you like

Origin blog.csdn.net/weixin_50545213/article/details/132452656