Skip to content

Symlinks of dependencies not resolving with medusa develop command #1859

Closed
@liamjcooper

Description

@liamjcooper

Bug report

Describe the bug

I followed the guide on creating a plugin for Medusa, but ended up hitting an issue trying to start an example Medusa project that was linked to my basic plugin locally.

With this plugin, I would see the following error on startup (of the Medusa server, not the plugin builder):

Error: Cannot find module 'medusa-interfaces'

System information

Medusa version (including plugins):

Medusa project versions:

"@medusajs/medusa": "^1.3.3",
"@medusajs/medusa-cli": "^1.3.1",
"medusa-core-utils": "^1.1.31",
"medusa-fulfillment-manual": "^1.1.31",
"medusa-interfaces": "^1.3.1",
"medusa-payment-manual": "^1.0.16",
"medusa-payment-stripe": "^1.1.38",
"mongoose": "^5.13.3",
"typeorm": "^0.2.36"

Plugin project versions (peer dependencies):

"@medusajs/medusa": "^1.3.3",
"medusa-interfaces": "^1.3.1"

Node.js version: 16.16.0
Database: SQLite
Operating system: Windows 11

Steps to reproduce the behavior

  1. Follow guide on how to create a plugin, I followed the Yarn instructions. The plugin should be linked to the Medusa project via yarn link
  2. Create a basic service that matches the examples from the repo
  3. Start watcher for plugin
  4. Start medusa server with develop command

Expected behavior

I expected the Medusa server to start up successfully, with no exceptions thrown, and a new service attached to the context.

Code snippets

The plugin had a service that included nothing more than the following:

// ./src/services/hello.js
import { BaseService } from "medusa-interfaces";

class HelloService extends BaseService {
  getMessage() {
    return "Hello world!";
  }
}

export default HelloService;

Additional context

I can create a PR for this right away as I have a branch ready with a possible fix, but wanted to follow contribution guidelines and post the issue first - get everyone's thoughts.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions