Skip to content

Fix usingProxy() on Windows#2562

Merged
SergeAstapov merged 3 commits intomiragejs:masterfrom
ijlee2:patch-2559-for-windows
Oct 18, 2023
Merged

Fix usingProxy() on Windows#2562
SergeAstapov merged 3 commits intomiragejs:masterfrom
ijlee2:patch-2559-for-windows

Conversation

@ijlee2
Copy link
Copy Markdown
Contributor

@ijlee2 ijlee2 commented Oct 18, 2023

Description

As mentioned in #2558 (comment), on Windows, my team member @Ajanth wasn't able to run the desired server even after I updated ember-cli-mirage to v3.0.1 (see #2559).

We think the issue is related to config/environment.js#L14, due to process.env.PWD and the hardcoded /'s.

After replacing process.env.PWD with process.cwd() and / with path.join(), we checked that we can run the server on both Windows and Mac. On Mac, I saw the same value logged for (1), (2), and (3):

console.log('(1) ' + `${process.env.PWD}/server/proxies`);
console.log('(2) ' + path.join(process.env.PWD, 'server', 'proxies'));
console.log('(3) ' + path.join(process.cwd(), 'server', 'proxies'));

Note, a StackOverflow answer suggests that process.env.PWD and process.cwd() can have a different meaning (value) when the current directory is changed. I'm not sure if that difference would affect ember-cli-mirage.

@SergeAstapov SergeAstapov changed the title Patch #2559 for Windows Make usingProxy() work on Windows Oct 18, 2023
@SergeAstapov SergeAstapov changed the title Make usingProxy() work on Windows Fix usingProxy() on Windows Oct 18, 2023
@SergeAstapov SergeAstapov merged commit 872cec9 into miragejs:master Oct 18, 2023
@ijlee2 ijlee2 deleted the patch-2559-for-windows branch October 19, 2023 05:32
francois2metz pushed a commit to francois2metz/ember-cli-mirage that referenced this pull request Dec 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants