fix(medusa): stop loading entry points in exec command (#13438)

This commit is contained in:
William Bouchard
2025-09-09 14:10:56 -04:00
committed by GitHub
parent 0b55295fc7
commit e0943f3c90
5 changed files with 15 additions and 13 deletions

View File

@@ -0,0 +1,5 @@
---
"@medusajs/medusa": patch
---
"fix(medusa): stop loading entry points in exec command

View File

@@ -91,7 +91,7 @@ async function populateData(api: any) {
)
const products = response.data.created
await setTimeout(4000)
await setTimeout(10000)
return products
}

View File

@@ -1,9 +1,5 @@
import { ExecArgs } from "@medusajs/framework/types"
import {
ContainerRegistrationKeys,
dynamicImport,
isFileSkipped,
} from "@medusajs/framework/utils"
import { ContainerRegistrationKeys, dynamicImport, isFileSkipped, } from "@medusajs/framework/utils"
import express from "express"
import { existsSync } from "fs"
import path from "path"
@@ -47,6 +43,7 @@ export default async function exec({ file, args }: Options) {
const { container } = await loaders({
directory,
expressApp: app,
skipLoadingEntryPoints: true,
})
const scriptParams: ExecArgs = {

View File

@@ -23,6 +23,7 @@ export default async function ({
const { container } = await loaders({
directory,
expressApp: app,
skipLoadingEntryPoints: true,
})
const logger = container.resolve(ContainerRegistrationKeys.LOGGER)

View File

@@ -33,6 +33,7 @@ import apiLoader from "./api"
type Options = {
directory: string
expressApp: Express
skipLoadingEntryPoints?: boolean
}
const isWorkerMode = (configModule) => {
@@ -71,7 +72,7 @@ async function jobsLoader(
) {
const pluginJobSourcePaths = [
/**
* Load jobs from the medusa/medusa package. Remove once the medusa core is converted to a plugin
* Load jobs from the medusa/medusa package. Remove once the medusa core is converted to a plugin
*/
join(__dirname, "../jobs"),
].concat(plugins.map((plugin) => join(plugin.resolve, "jobs")))
@@ -161,6 +162,7 @@ export async function initializeContainer(
export default async ({
directory: rootDirectory,
expressApp,
skipLoadingEntryPoints = false,
}: Options): Promise<{
container: MedusaContainer
app: Express
@@ -198,12 +200,9 @@ export default async ({
const workflowLoader = new WorkflowLoader(workflowsSourcePaths, container)
await workflowLoader.load()
const entrypointsShutdown = await loadEntrypoints(
plugins,
container,
expressApp,
rootDirectory
)
const entrypointsShutdown = skipLoadingEntryPoints
? () => {}
: await loadEntrypoints(plugins, container, expressApp, rootDirectory)
const { createDefaultsWorkflow } = await import("@medusajs/core-flows")
await createDefaultsWorkflow(container).run()