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

Fix relative path resolution #25

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

c-harding
Copy link

Previously, this module was incorrectly resolving paths. For an import of A/b from file /C/d.scss, it was looking in [/C/A, /C, /] for a file d.android.scss/d.ios.scss, d.native.scss, d.scss.

For an import of A/b from file /C/d.scss, it now looks in [/C/A, /A] for a file d.android.scss/d.ios.scss, d.native.scss, d.scss.

This means that @import 'styles/general' from a file my-project/component/header/styles.scss no longer incorrectly resolves to my-project/general.ios.scss or my-project/component/header/general.ios.scss. It still resolves to my-project/component/header/styles/general.ios.scss, if it exists, but if that fails it now falls back to my-project/styles/general.ios.scss.

I have also submitted this PR to kristerkari/react-native-typed-sass-transformer#4.

@kristerkari
Copy link
Owner

Thanks a lot! I'll do some testing for the changes.

@c-harding
Copy link
Author

When I tried it today, incPaths.map(incPath => path.resolve(incPath, urlPath.dir)); did work instead of the for loop. I'm not really sure what caused the "FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal."

@kristerkari
Copy link
Owner

I'm not really sure what caused the "FATAL ERROR: v8::ToLocalChecked Empty MaybeLocal."

That's an error from NodeJS' V8, so it might get fixed by updating your NodeJS version.

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.

2 participants