stealjs / steal-tools

Build easy. Load fast.
https://stealjs.com/docs/steal-tools.html
MIT License
67 stars 23 forks source link

process.cwd substring modules falsely on windows #1046

Closed pYr0x closed 6 years ago

pYr0x commented 6 years ago

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

green3g commented 6 years ago

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/

matthewp commented 6 years ago

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

green3g commented 6 years ago

process.platform === 'win32'

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