Skip to content

Commit 2544734

Browse files
committed
fix: esbuild plugins not matching windows paths
1 parent 8530f7c commit 2544734

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

packages/open-next/src/plugins/edge.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ export function openNextEdgePlugins({
5858
logger.debug(chalk.blue("OpenNext Edge plugin"));
5959
if (edgeFunctionHandlerPath) {
6060
// If we bundle the routing, we need to resolve the middleware
61-
build.onResolve({ filter: /\.\/middleware.mjs/g }, () => {
61+
build.onResolve({ filter: /\.(\/|\\)middleware.mjs/g }, () => {
6262
return {
6363
path: edgeFunctionHandlerPath,
6464
};
@@ -93,7 +93,7 @@ export function openNextEdgePlugins({
9393
);
9494

9595
// We inject the entry files into the edgeFunctionHandler
96-
build.onLoad({ filter: /\/edgeFunctionHandler.js/g }, async (args) => {
96+
build.onLoad({ filter: /(\/|\\)edgeFunctionHandler.js/g }, async (args) => {
9797
let contents = readFileSync(args.path, "utf-8");
9898
contents = `
9999
globalThis._ENTRIES = {};
@@ -160,7 +160,7 @@ ${contents}
160160
};
161161
});
162162

163-
build.onLoad({ filter: /adapters\/config\/index/g }, async () => {
163+
build.onLoad({ filter: /adapters(\/|\\)config(\/|\\)index/g }, async () => {
164164
const NextConfig = loadConfig(nextDir);
165165
const BuildId = loadBuildId(nextDir);
166166
const HtmlPages = loadHtmlPages(nextDir);

packages/open-next/src/plugins/replacement.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ const importPattern = /\/\/#import([\s\S]*?)\n\/\/#endImport/gm;
1818
/**
1919
*
2020
* openNextPlugin({
21-
* target: /plugins\/default\.js/g,
21+
* target: /plugins(\/|\\)default\.js/g,
2222
* replacements: [require.resolve("./plugins/default.js")],
2323
* deletes: ["id1"],
2424
* })

0 commit comments

Comments
 (0)