From ab0f8b25fdfff5e332b8c4a035cc648c5627216d Mon Sep 17 00:00:00 2001 From: Costin Sin Date: Mon, 8 Jul 2024 20:45:33 +0300 Subject: [PATCH] [windows] Add Windows compatibility for the `resolve` ESBuild plugin (#461) * [windows] Add Windows compatibility for the `resolve` ESBuild plugin Previously, the separator for the filter regex was hardcoded to / (Unix separator). Now, we're also taking account for the \ (Windows separator) in the filter regex. Signed-off-by: Costin Sin * Create popular-kids-beam.md --------- Signed-off-by: Costin Sin Co-authored-by: conico974 --- .changeset/popular-kids-beam.md | 5 +++++ packages/open-next/src/plugins/resolve.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/popular-kids-beam.md diff --git a/.changeset/popular-kids-beam.md b/.changeset/popular-kids-beam.md new file mode 100644 index 00000000..9dea5c74 --- /dev/null +++ b/.changeset/popular-kids-beam.md @@ -0,0 +1,5 @@ +--- +"open-next": patch +--- + +[windows] Add Windows compatibility for the `resolve` ESBuild plugin diff --git a/packages/open-next/src/plugins/resolve.ts b/packages/open-next/src/plugins/resolve.ts index f654d14b..48eb2f3a 100644 --- a/packages/open-next/src/plugins/resolve.ts +++ b/packages/open-next/src/plugins/resolve.ts @@ -44,7 +44,7 @@ export function openNextResolvePlugin({ name: "opennext-resolve", setup(build) { logger.debug(`OpenNext Resolve plugin for ${fnName}`); - build.onLoad({ filter: /core\/resolve.js/g }, async (args) => { + build.onLoad({ filter: /core(\/|\\)resolve\.js/g }, async (args) => { let contents = readFileSync(args.path, "utf-8"); //TODO: refactor this. Every override should be at the same place so we can generate this dynamically if (overrides?.wrapper) {