Skip to content

Commit

Permalink
[windows] Add Windows compatibility for the replacement ESBuild plu…
Browse files Browse the repository at this point in the history
…gin (#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]>
  • Loading branch information
costinsin and conico974 authored Jul 8, 2024
1 parent ab0f8b2 commit 7beaf82
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 3 deletions.
5 changes: 5 additions & 0 deletions .changeset/shy-cups-notice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"open-next": patch
---

[windows] Add Windows compatibility for the `replacement` ESBuild plugin
3 changes: 2 additions & 1 deletion packages/open-next/src/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,8 @@ async function createImageOptimizationBundle(config: OpenNextConfig) {
plugins.push(
openNextReplacementPlugin({
name: "opennext-14.1.1-image-optimization",
target: /plugins\/image-optimization\/image-optimization\.js/g,
target:
/plugins(\/|\\)image-optimization(\/|\\)image-optimization\.js/g,
replacements: [
require.resolve(
"./adapters/plugins/image-optimization/image-optimization.replacement.js",
Expand Down
4 changes: 2 additions & 2 deletions packages/open-next/src/build/createServerBundle.ts
Original file line number Diff line number Diff line change
Expand Up @@ -207,7 +207,7 @@ async function generateBundle(
const plugins = [
openNextReplacementPlugin({
name: `requestHandlerOverride ${name}`,
target: /core\/requestHandler.js/g,
target: /core(\/|\\)requestHandler\.js/g,
deletes: disableNextPrebundledReact ? ["applyNextjsPrebundledReact"] : [],
replacements: disableRouting
? [
Expand All @@ -219,7 +219,7 @@ async function generateBundle(
}),
openNextReplacementPlugin({
name: `utilOverride ${name}`,
target: /core\/util.js/g,
target: /core(\/|\\)util\.js/g,
deletes: [
...(disableNextPrebundledReact ? ["requireHooks"] : []),
...(disableRouting ? ["trustHostHeader"] : []),
Expand Down

0 comments on commit 7beaf82

Please sign in to comment.