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

renderSync fails in some cases with no file or directory exception #1395

Closed
extempl opened this issue Jul 13, 2021 · 7 comments
Closed

renderSync fails in some cases with no file or directory exception #1395

extempl opened this issue Jul 13, 2021 · 7 comments

Comments

@extempl
Copy link

extempl commented Jul 13, 2021

I have an issue, when the renderSync located in webpack fails, but not always, in my case it fails on storybook test.
I found the issue, but I do not understand why it happens.
The core issue is that the var file = options.file.andThen(p.absolute); returns http://localhost/absolute/path/to/file.scss when /absolute/path/to/file.scss passed as a file parameter.
Could someone point me in to the right direction on solving this? May be it is about config (hovewer, it does work when I run the project with this webpack file)?
in both cases options.file and p.absolute are looks the same (well, as far as I am able to see via debugger, as p.absolute is some weird complex object)

@Awjin
Copy link
Contributor

Awjin commented Jul 14, 2021

It's hard to understand what's going on here without more context. Could you provide more code that illustrates your problem? In what environment are you trying to compile Sass (e.g. why is http://localhost/absolute/path/to/file.scss being passed as an absolute path here)?

@extempl
Copy link
Author

extempl commented Jul 15, 2021

It's hard to understand what's going on here without more context. Could you provide more code that illustrates your problem? In what environment are you trying to compile Sass (e.g. why is http://localhost/absolute/path/to/file.scss being passed as an absolute path here)?

It is not passed. It is returned from the options.file.andThen(p.absolute) when options.file is /absolute/path/to/file.scss.
I am not sure about environment (I'll check), but it is just should not attach http://localhost when I am providing with absolute (! not the relative) path, should it?

@extempl
Copy link
Author

extempl commented Jul 15, 2021

@Awjin
Here, I was able to replicate it with fresh and clean ejected create-react-app + storybook:
https://github.com/extempl/dart-sass-test
https://dsh.re/ef6d1
The environment is test, hovewer, when I manually launching the app with test env set - everything is fine in this place.

To run - yarn start - no issue, the content is logged to the console.
To see the issue - yarn test - no file or directory. Note that the webpack is imported in the .storybook/main - this is to imitate its usage in my project, but it is enough to just import as the sass.renderSync code is invoked.

You can see there is a somewhat relative path with ../, but this is just to not change boilerplate, does not matter, reproduced with any case.

@Awjin
Copy link
Contributor

Awjin commented Jul 15, 2021

It looks like this is a problem with Jest, and not Sass. See this duplicate issue #710 for workarounds.

@Awjin Awjin closed this as completed Jul 15, 2021
@extempl
Copy link
Author

extempl commented Jul 16, 2021

@Awjin Okay. fine, but in my point of view, no changes should be applied to the path at all when I am providing the absolute path. And this is the issue of dart sass code. Better to add parameter like absolute: Bool when I could identify that this path is final and to not be modified.
I am telling to the system where the file is, and from where to read it (fs does this w/o issues). The system calls some external processor to absolutize the path and this code fails. But it should not call that code in the first place.

@extempl
Copy link
Author

extempl commented Jul 16, 2021

Mentioning this here as well: dart-lang/sdk#27979

@extempl
Copy link
Author

extempl commented Jul 16, 2021

Btw, I do not see that includePaths option is used by renderSync at all, while readme says it is used.

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

No branches or pull requests

2 participants