Npm Module integration in cocos creator 3.x

Help Needed: Issues with Initializing npm Packages in Cocos Creator v3.8

Hi everyone,

I’ve been working on a project using Cocos Creator and recently upgraded from version 2.4 to version 3.8. In version 2.4, I successfully integrated several npm packages without any issues. However, after upgrading to version 3.8, I’m encountering problems when trying to initialize these npm packages.

Problem Description:

  • Initialization: I followed the same initialization steps that worked in version 2.4.
  • Compilation: The scripts are not compiling correctly within the editor in version 3.8.
  • Functionality: The npm packages that worked perfectly in version 2.4 are now causing issues in version 3.8.

Steps Taken:

  1. Installed the npm packages using the terminal.
  2. Imported the packages in my project scripts.
  3. Tried reloading the project and rebuilding it multiple times.

Observations:

  • The editor does not recognize the imported packages and throws compilation errors.
  • No specific error messages that indicate what might be wrong with the imports.

Questions:

  1. Is there a specific way to import npm packages in Cocos Creator v3.x that differs from v2.4?
  2. Has anyone else faced similar issues with npm packages in version 3.8?
  3. Are there any additional steps or configurations required for npm packages to work in Cocos Creator v3.8?

Any guidance or solutions would be greatly appreciated! Thank you in advance for your help.

Hi , thanks for your feedback.

Did you find any error logs in the console of Cocos Creator 3.x ?