Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass patterns with forward-slashes #34

Closed
wants to merge 1 commit into from

Conversation

DiegoVictor
Copy link

The globby library doesn't accept backward-slashes on sync function:

Note that glob patterns can only contain forward-slashes, not backward-slashes, so if you want to construct a glob pattern from path components, you need to use `path.posix.join()` instead of `path.join()`.

Ref: https://github.com/sindresorhus/globby#api

This is the reason to the path replacement doesn't work properly on some Windows consoles/terminals. Windows uses backward slashes:

D:\git\tsconfig-replace-paths\dist/**/*.{js,jsx,ts,tsx}

This PR makes sure to always pass a pattern with forward-slashes:

D:/git/tsconfig-replace-paths/dist/**/*.{js,jsx,ts,tsx}

@Autofan1992
Copy link

@jonkwheeler please merge this pr. Everything works fine on mac os , but on windows it doesn’t work at all. Thank you!

@DiegoVictor
Copy link
Author

@jonkwheeler please merge this pr. Everything works fine on mac os , but on windows it doesn’t work at all. Thank you!

@Autofan1992 I created a fork (actually a new library) with the fix and other stuff: https://github.com/DiegoVictor/tsc-path-replacer

@jonkwheeler
Copy link
Owner

Happy you found a work around. I just haven't had time to test this.

@jonkwheeler
Copy link
Owner

I just tested this and it failed on one of my repos. It said it replaced 0 paths... ?

$ tsc --project tsconfig.types.cjs.json && tsconfig-replace-paths --project tsconfig.types.cjs.json
Replaced 0 paths in 0 files
$ tsc --project tsconfig.types.esm.json && tsconfig-replace-paths --project tsconfig.types.esm.json
Replaced 0 paths in 0 files

I'll happily reopen if a different fix is presented.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants