最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

node.js - ReferenceError: exports is not defined in ES module scope while deploying - Stack Overflow

programmeradmin5浏览0评论

I am getting this error "ReferenceError: exports is not defined in ES module scope" while deploying my backend to render

I just have two typescript files which when compiled creates two .js files automatically.

This is how I am importing and exporting things between my two typescript files

import axios from "axios";
`import * as cron from "node-cron";
import { BASE_URL, Expenses } from "./recurring-logic.js";

export interface ProfileData {
    maxXp: number;
    xp: number;
    title: string;
    level: number;
}

My package.json contains this line "type": "module",`

The image shows the files in my directory.

What am I doing wrong here and What should I do to get it deployed ?

I tried converting my imports from "import cron from "node-cron"; this to "import * as cron from "node-cron";

this as said by chatGPT but didn't work out. It still shows the same error.

发布评论

评论列表(0)

  1. 暂无评论