Skip to content

Commit d0de04a

Browse files
committed
[windows] Add Windows compatibility for the resolve ESBuild plugin
Previously, the separator for the filter regex was hardcoded to `/` (Unix separator). Now, instead of hardcoding the separator, we are using the cross-platform `path.join` function. It's result is regex escaped using the `escape-string-regexp` library. Signed-off-by: Costin Sin <[email protected]>
1 parent 001aaa0 commit d0de04a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ export function openNextResolvePlugin({
4444
name: "opennext-resolve",
4545
setup(build) {
4646
logger.debug(`OpenNext Resolve plugin for ${fnName}`);
47-
build.onLoad({ filter: /core\/resolve.js/g }, async (args) => {
47+
build.onLoad({ filter: /core(\/|\\)resolve\.js/g }, async (args) => {
4848
let contents = readFileSync(args.path, "utf-8");
4949
//TODO: refactor this. Every override should be at the same place so we can generate this dynamically
5050
if (overrides?.wrapper) {

0 commit comments

Comments
 (0)