stealjs / steal

Gets JavaScript
https://stealjs.com
MIT License
1.37k stars 522 forks source link

ENOENT 'stealconfig.js' on node/Windows when configMain is not specified #1552

Open bmomberger-bitovi opened 1 year ago

bmomberger-bitovi commented 1 year ago

How often can you reproduce it?

Description:

Steps to reproduce:

In a node process,

Expected results:

Actual results:

Deep analysis:

steal/main.js line 2241: getUrlOptions() sets a default stealPath to __dirname, which uses backslashes on windows

this is a problem when we get to specialConfig.stealPath.set(), line 1995 or so, because parts has been created by splitting dirname (which is envPath(stealPath)) on "/", line 1971. This makes the test after isNode fail because it's not getting the last path element correctly

There's only two places I see backslashes being replaced with forward slashes:

so isWindows is declared both on lines 2467 and 4737. that doesn't cover either of the scopes where it may be needed. I think it comes down to fixing the appropriate source files. I just don't know

In the meantime, setting configMain manually to "package.json!npm" when configuring should provide a workaround.

Environment:

Software Version
Steal version 2.3.0
Steal-tools version N/A
node -v 14.21.2
npm -v 6.14.17
Browser JSDOM
Operating system Windows 10