Baike.dev
All toolsOnline toolsAI codingTrendingOpen sourceNewsSubmit
Log in
Back to tool/Back to issues
#1319·moleculer

Hot reload doesn't work in ESM

Author: wiwokandCreated Mar 2, 2025Updated Mar 9, 2025

Prerequisites

  • I am running the latest version
  • I checked the documentation and found no answer
  • I checked to make sure that this issue has not already been filed
  • I'm reporting the issue to the correct repository

Current Behavior

In the console it says that the service is restarted, but nothing actually happens

Expected Behavior

Hot reload should work with moleculer-runner in ESM

Steps to Reproduce

Please provide detailed steps for reproducing the issue.

  1. Set type: module in package.json
  2. In package.json, write the command to start moleculer-runner --repl --hot --config moleculer.config.js src/services/*Service.js
  3. Try it out

Reproduce code snippet

javascript
import { Service } from "moleculer";
import ApiGateway from "moleculer-web";

export default class ApiService extends Service {
  constructor(broker) {
    super(broker);
    this.parseServiceSchema({
      name: "api",
      mixins: [ApiGateway],
      settings: {
        port: 3000,
        routes: [
          {
            path: "/",
            aliases: {
              "GET ping": "api.ping",
            },
          },
        ],
      },
      actions: {
        ping() {
          return { ping: "pong1" };
        },
      },
    });
  }
}

P.s. you can check demo snippet in my github repo "DemoMoleculer"

Context

  • Moleculer version: 0.14.35
  • NodeJS version: 22.12.0
  • Operating System: windows 11

Source: moleculerjs/moleculer

View original on GitHubView discussion on GitHub