Skip to content

Commit 1722a4b

Browse files
committed
[windows] Add Windows compatibility for the replacement 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-Robert Sin <[email protected]>
1 parent 001aaa0 commit 1722a4b

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

packages/open-next/src/build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -333,7 +333,8 @@ async function createImageOptimizationBundle(config: OpenNextConfig) {
333333
plugins.push(
334334
openNextReplacementPlugin({
335335
name: "opennext-14.1.1-image-optimization",
336-
target: /plugins\/image-optimization\/image-optimization\.js/g,
336+
target:
337+
/plugins(\/|\\)image-optimization(\/|\\)image-optimization\.js/g,
337338
replacements: [
338339
require.resolve(
339340
"./adapters/plugins/image-optimization/image-optimization.replacement.js",

packages/open-next/src/build/createServerBundle.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ async function generateBundle(
207207
const plugins = [
208208
openNextReplacementPlugin({
209209
name: `requestHandlerOverride ${name}`,
210-
target: /core\/requestHandler.js/g,
210+
target: /core(\/|\\)requestHandler\.js/g,
211211
deletes: disableNextPrebundledReact ? ["applyNextjsPrebundledReact"] : [],
212212
replacements: disableRouting
213213
? [
@@ -219,7 +219,7 @@ async function generateBundle(
219219
}),
220220
openNextReplacementPlugin({
221221
name: `utilOverride ${name}`,
222-
target: /core\/util.js/g,
222+
target: /core(\/|\\)util\.js/g,
223223
deletes: [
224224
...(disableNextPrebundledReact ? ["requireHooks"] : []),
225225
...(disableRouting ? ["trustHostHeader"] : []),

0 commit comments

Comments
 (0)