VM257:11 页面【pages/index/index]错误:
Error: module 'utils/utils.js'
is not defined, require args is
'../../utils/utils.js' at q (WASubContext.js?t=wechat&s=1724662625476&v=3.5.5:1) at r
(WASubContext.js?t=wechat&s=1724662625476&v=3.5.5:1) at index.js?
[sm]:3 at WASubContext.js?t=wechat&s=1724662625476&v=3.5.5:1 at
p.runWith (WASubContext.js?t=wechat&s=1724662625476&v=3.5.5:1) at
q (WASubContext.js?t=wechat&s=1724662625476&v=3.5.5:1) at
i.tryJs.spyCustom.window.require (beforebaselibready.js?
t=wechat&s=1724662625476&v=9482ab53d047e88e7b840ccae572e1f6:9) at
<anonymous>:8:5 at evaluateRes (index.js:1) at index.js:1(env:
Windows,mp,1.06.2405020; lib: 3.5.5)
解决方式不使用module.exports
使用 export function 的形式
例如
//静态变量
export function getXXX(){
return xxx;
}
//函数
export function xxx(a,b,c){
return xxxxx;
}
导入方式
import { getXXX }from "地址"