fix(medusa): Normalize subscriber paths (#5703)
This commit is contained in:
committed by
GitHub
parent
f3e20379b0
commit
22bea2724d
5
.changeset/beige-zebras-explain.md
Normal file
5
.changeset/beige-zebras-explain.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"@medusajs/medusa": patch
|
||||
---
|
||||
|
||||
fix(medusa): Exclude subscribers correctly on Windows
|
||||
@@ -579,8 +579,6 @@ async function registerSubscribers(
|
||||
container: MedusaContainer,
|
||||
activityId: string
|
||||
): Promise<void> {
|
||||
const exclude: string[] = []
|
||||
|
||||
const loadedFiles = await new SubscriberLoader(
|
||||
path.join(pluginDetails.resolve, "subscribers"),
|
||||
container,
|
||||
@@ -591,11 +589,12 @@ async function registerSubscribers(
|
||||
/**
|
||||
* Exclude any files that have already been loaded by the subscriber loader
|
||||
*/
|
||||
exclude.push(...(loadedFiles ?? []))
|
||||
const normalizedLoadedFiles =
|
||||
loadedFiles?.map((file) => file.replace(/\\/g, "/")) ?? []
|
||||
|
||||
const files = glob.sync(`${pluginDetails.resolve}/subscribers/*.js`, {})
|
||||
files
|
||||
.filter((file) => !exclude.includes(file))
|
||||
.filter((file) => !normalizedLoadedFiles.includes(file))
|
||||
.forEach((fn) => {
|
||||
const loaded = require(fn).default
|
||||
|
||||
|
||||
Reference in New Issue
Block a user