Wepy cannot reference npm package

Business background

use wepy to develop Mini Program
for the first time, you need to use md5 > encrypt data and then request remote data
install js-md5
through npm , but cannot reference this package through require in the project.

directory structure

site directory

...
node_modules
dist
  ...
  npm
    ...
src
  ...
  pages
  public
    ...
    js
      api.js
  app.wpy

related codes

npm

npm install js-md5 --save

api.js

const md5 = require("js-md5")

error content

after wepy build-- watch is executed on the terminal, Mini Program"s development tool reports the following error when compiling

thirdScriptError 
 sdk uncaught third Error 
 module "npm/js-md5/src/md5.js" is not defined 
 Error: module "npm/js-md5/src/md5.js" is not defined

try

  • you can manually put the package downloaded by npm into the dist/npm directory
  • .
  • or use the relative path to navigate to js-md5.js this file can also be

question

how do I make wepy automatically compile dependent packages under the dist/npm directory?
take a look at wepy.cnfig.js where it doesn"t seem to be set

.
Mar.06,2021

delete the npm folder in node_modules and dist, reinstall and run


I also want to know
brother solution? I'm also working on base64 encryption. This is also the case


replacing js-md5 with blueimp-md5, can avoid this problem

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1b3159d-2bd9e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1b3159d-2bd9e.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?