Skip to content

Commit 7beaf82

Browse files
costinsinconico974
andauthored
[windows] Add Windows compatibility for the replacement ESBuild plugin (#465)
* [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]> * Create shy-cups-notice.md --------- Signed-off-by: Costin-Robert Sin <[email protected]> Co-authored-by: conico974 <[email protected]>
1 parent ab0f8b2 commit 7beaf82

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

.changeset/shy-cups-notice.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"open-next": patch
3+
---
4+
5+
[windows] Add Windows compatibility for the `replacement` ESBuild plugin

packages/open-next/src/build.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,8 @@ async function createImageOptimizationBundle(config: OpenNextConfig) {
335335
plugins.push(
336336
openNextReplacementPlugin({
337337
name: "opennext-14.1.1-image-optimization",
338-
target: /plugins\/image-optimization\/image-optimization\.js/g,
338+
target:
339+
/plugins(\/|\\)image-optimization(\/|\\)image-optimization\.js/g,
339340
replacements: [
340341
require.resolve(
341342
"./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)