File tree Expand file tree Collapse file tree 6 files changed +23
-5
lines changed Expand file tree Collapse file tree 6 files changed +23
-5
lines changed Original file line number Diff line number Diff line change 1+ ---
2+ " open-next " : patch
3+ ---
4+
5+ [ windows] Add Windows compatibility for the ` resolve ` ESBuild plugin
Original file line number Diff line number Diff line change 1+ ---
2+ " open-next " : patch
3+ ---
4+
5+ [ windows] Add Windows compatibility for the ` replacement ` ESBuild plugin
Original file line number Diff line number Diff line change 1+ ---
2+ " open-next " : patch
3+ ---
4+
5+ [ windows] Specify the ` file:// ` protocol when importing config on Windows
Original file line number Diff line number Diff line change @@ -50,11 +50,13 @@ export async function build(
5050
5151 // Load open-next.config.ts
5252 const tempDir = initTempDir ( ) ;
53- const configPath = compileOpenNextConfigNode (
53+ let configPath = compileOpenNextConfigNode (
5454 tempDir ,
5555 openNextConfigPath ,
5656 nodeExternals ,
5757 ) ;
58+ // On Windows, we need to use file:// protocol to load the config file using import()
59+ if ( process . platform === "win32" ) configPath = `file://${ configPath } ` ;
5860 config = ( await import ( configPath ) ) . default as OpenNextConfig ;
5961 validateConfig ( config ) ;
6062
@@ -333,7 +335,8 @@ async function createImageOptimizationBundle(config: OpenNextConfig) {
333335 plugins . push (
334336 openNextReplacementPlugin ( {
335337 name : "opennext-14.1.1-image-optimization" ,
336- target : / p l u g i n s \/ i m a g e - o p t i m i z a t i o n \/ i m a g e - o p t i m i z a t i o n \. j s / g,
338+ target :
339+ / p l u g i n s ( \/ | \\ ) i m a g e - o p t i m i z a t i o n ( \/ | \\ ) i m a g e - o p t i m i z a t i o n \. j s / g,
337340 replacements : [
338341 require . resolve (
339342 "./adapters/plugins/image-optimization/image-optimization.replacement.js" ,
Original file line number Diff line number Diff line change @@ -207,7 +207,7 @@ async function generateBundle(
207207 const plugins = [
208208 openNextReplacementPlugin ( {
209209 name : `requestHandlerOverride ${ name } ` ,
210- target : / c o r e \/ r e q u e s t H a n d l e r .j s / g,
210+ target : / c o r e ( \/ | \\ ) r e q u e s t H a n d l e r \ .j s / 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 : / c o r e \/ u t i l .j s / g,
222+ target : / c o r e ( \/ | \\ ) u t i l \ .j s / g,
223223 deletes : [
224224 ...( disableNextPrebundledReact ? [ "requireHooks" ] : [ ] ) ,
225225 ...( disableRouting ? [ "trustHostHeader" ] : [ ] ) ,
Original file line number Diff line number Diff 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 : / c o r e \/ r e s o l v e .j s / g } , async ( args ) => {
47+ build . onLoad ( { filter : / c o r e ( \/ | \\ ) r e s o l v e \ .j s / 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 ) {
You can’t perform that action at this time.
0 commit comments