You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/user/index.js
require() of ES modules is not supported.
require() of /var/user/index.js from /var/runtime/node12/UserFunction.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /var/user/package.json.
The text was updated successfully, but these errors were encountered:
相关平台
微信小程序
小程序基础库: 未发布
使用框架: React
复现步骤
通过 gitee以最快方式下载taro微信小程序模版,
选择了云开发模版,
@tarojs/cli 版本为3.4.3,
在config/index中添加 const path = require('path') ;
期望结果
成功启动运行项目
实际结果
很多文件无法导入
环境信息
补充信息
Error: cloud.callFunction:fail Error: errCode: -504002 functions execute fail | errMsg: Error [ERR_REQUIRE_ESM]: Must use import to load ES Module: /var/user/index.js
require() of ES modules is not supported.
require() of /var/user/index.js from /var/runtime/node12/UserFunction.js is an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which defines all .js files in that package scope as ES modules.
Instead rename index.js to end in .cjs, change the requiring code to use import(), or remove "type": "module" from /var/user/package.json.
The text was updated successfully, but these errors were encountered: