admin管理员组文章数量:1303668
I'm caught in the hell of Node/JavaScript versions. I'm getting the error, " The requested module '../../index.mjs' does not provide an export named 'handler'"
My calling file is like this.
import { handler } from '../../index.mjs'
handler(event, null, null);
But index.mjs contains:
export const handler = async (event, context) => {
var test = 0;
}
I've also tried
exports.handler = handler;
and
const _handler = handler;
export { _handler as handler };
I've tried .mjs, and .js file extensions. My package.json is set to "type": "module"
EDIT: This also doesn't work.
export async function handler(event, context) {
var test = 0;
}
本文标签: nodejsThe requested module 39indexmjs39 does not provide an export named 39handler39Stack Overflow
版权声明:本文标题:node.js - The requested module 'index.mjs' does not provide an export named 'handler' - Stack Ov 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1741686357a2392464.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论