stealjs/steal-tools

process.cwd substring modules falsely on windows

pYr0x opened this issue · 3 comments

pYr0x commented

i had the same problem as @roemhildtg
his comments on gitter: https://gitter.im/stealjs/steal?at=5b536af0ee530e4aac8b471c

it seems we are the only one using windows :)

the bug is on https://github.com/stealjs/steal-tools/blob/master/lib/graph/treeshake.js#L222
the problem is, that on macOS the path on process.cwd() starts with /. on windows process.cwd() starts with C:/

so we need to check the os and substring different https://github.com/stealjs/steal-tools/blob/master/lib/graph/treeshake.js#L19 if we are on windows

I tried applying this patch, but it still doesn't work for me.

Try it with the upgrade-canjs-5 branch here:
https://github.com/roemhildtg/spectre-canjs/tree/upgrade-canjs-5

Type

npm install
npm run docs
npm start

and try browsing to one of the demo pages like http://lvh.me:8080/sp-modal/demo/

@roemhildtg What if you change his windows check to process.platform === 'win32' instead?

process.platform === 'win32'

Also, os.type() === 'Windows_NT'