react-native-sass-transformer icon indicating copy to clipboard operation
react-native-sass-transformer copied to clipboard

Fix relative path resolution

Open c-harding opened this issue 4 years ago • 3 comments

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 https://github.com/kristerkari/react-native-typed-sass-transformer/pull/4.

c-harding avatar Jul 09 '19 22:07 c-harding

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

kristerkari avatar Jul 10 '19 06:07 kristerkari

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."

c-harding avatar Jul 10 '19 19:07 c-harding

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.

kristerkari avatar Jul 11 '19 07:07 kristerkari