Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug]: Dynamic route segments ([id]) are renamed to _id_ during plugin build process #11777

Closed
MounsifChr opened this issue Mar 8, 2025 · 2 comments

Comments

@MounsifChr
Copy link

Package.json file

{
  "name": "medusa-plugin-wishlist",
  "version": "0.0.1",
  "description": "A starter for Medusa plugins.",
  "author": "Medusa (https://medusajs.com)",
  "license": "MIT",
  "files": [
    ".medusa/server"
  ],
  "exports": {
    "./package.json": "./package.json",
    "./workflows": "./.medusa/server/src/workflows/index.js",
    "./.medusa/server/src/modules/*": "./.medusa/server/src/modules/*/index.js",
    "./modules/*": "./.medusa/server/src/modules/*/index.js",
    "./providers/*": "./.medusa/server/src/providers/*/index.js",
    "./*": "./.medusa/server/src/*.js"
  },
  "keywords": [
    "medusa",
    "plugin",
    "medusa-plugin-other",
    "medusa-plugin",
    "medusa-v2"
  ],
  "scripts": {
    "build": "medusa plugin:build",
    "dev": "medusa plugin:develop",
    "prepublishOnly": "medusa plugin:build"
  },
  "devDependencies": {
    "@medusajs/admin-sdk": "2.4.0",
    "@medusajs/cli": "2.4.0",
    "@medusajs/framework": "2.4.0",
    "@medusajs/medusa": "2.4.0",
    "@medusajs/test-utils": "2.4.0",
    "@medusajs/ui": "4.0.4",
    "@medusajs/icons": "2.4.0",
    "@mikro-orm/cli": "6.4.3",
    "@mikro-orm/core": "6.4.3",
    "@mikro-orm/knex": "6.4.3",
    "@mikro-orm/migrations": "6.4.3",
    "@mikro-orm/postgresql": "6.4.3",
    "@swc/core": "1.5.7",
    "@types/node": "^20.0.0",
    "@types/react": "^18.3.2",
    "@types/react-dom": "^18.2.25",
    "awilix": "^8.0.1",
    "pg": "^8.13.0",
    "prop-types": "^15.8.1",
    "react": "^18.2.0",
    "react-dom": "^18.2.0",
    "ts-node": "^10.9.2",
    "typescript": "^5.6.2",
    "vite": "^5.2.11",
    "yalc": "^1.0.0-pre.53"
  },
  "peerDependencies": {
    "@medusajs/admin-sdk": "2.4.0",
    "@medusajs/cli": "2.4.0",
    "@medusajs/framework": "2.4.0",
    "@medusajs/test-utils": "2.4.0",
    "@medusajs/medusa": "2.4.0",
    "@medusajs/ui": "4.0.3",
    "@medusajs/icons": "2.4.0",
    "@mikro-orm/cli": "6.4.3",
    "@mikro-orm/core": "6.4.3",
    "@mikro-orm/knex": "6.4.3",
    "@mikro-orm/migrations": "6.4.3",
    "@mikro-orm/postgresql": "6.4.3",
    "awilix": "^8.0.1",
    "pg": "^8.13.0"
  },
  "engines": {
    "node": ">=20"
  },
  "packageManager": "[email protected]+sha512.a6b2f7906b721bba3d67d4aff083df04dad64c399707841b7acf00f6b133b7ac24255f2652fa22ae3534329dc6180534e98d17432037ff6fd140556e2bb3137e"
}

Node.js version

v22.0.0

Database and its version

PostgreSQL 14.15

Operating system name and version

Ubuntu 22.04.5 LTS

Browser name

Firefox

What happended?

When building a MedusaJS plugin with dynamic route segments (e.g., admin/custom/[id]/page.tsx), the [id] folder is renamed to _id_ in the build output. This breaks the dynamic routing functionality in the admin UI.

Expected behavior

The [id] folder should be preserved in the build output, allowing dynamic routes to work as expected.

Actual behavior

The [id] folder is renamed to _id_ in the build output, causing dynamic routes to fail.

Link to reproduction repo

https://github.com/MounsifChr/medusajs-plugin-route-segments-issue/tree/master/medusa-plugin-wishlist

@kasperkristensen
Copy link
Contributor

Hi @MounsifChr, thanks for the report. We are aware of the issue, admin extensions in plugin currently don't work for production. It will be fixed in 2.6.2/2.7.0 which should be released next week.

In the meantime, if you want to carry on with working on your plugin you can use the snapshot versions that you can find on this PR: #11720.

@MounsifChr
Copy link
Author

Thanks @kasperkristensen.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants