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

Make default baseDir relative to each file #5

Merged
merged 1 commit into from
Jun 2, 2019
Merged

Make default baseDir relative to each file #5

merged 1 commit into from
Jun 2, 2019

Conversation

NoxWings
Copy link
Contributor

I was having a problem with relative imports and I fixed it this way.

- chunks
  - common.glsl
- flat
  - vertex.glsl
- phong
  - custom.glsl
  - vertex.glsl

I import on my js code

import flatVertex from "./flat/vertex.glsl";
import phongVertex from "./phong/vertex.glsl";

...

And then lets look at phong/vertex.glsl

#version 300 es
#pragma glslify: import("../chunks/common.glsl")
#pragma glslify: import("./common.glsl")

The problem I get with that is that the first file processed in this case flat/vertex.glsl sets options.baseDir to flat/ and the second phong/vertex.glsl file uses that same baseDir flat/ instead of phong/ resulting in a relative import not being found (./common.glsl).

@NoxWings
Copy link
Contributor Author

I might need to add a test case to cover that

@pschroen
Copy link
Member

pschroen commented Jun 2, 2019

Verified the problem and fix, no need for a test case, thanks! :)

@pschroen pschroen merged commit 9d0c0df into glslify:master Jun 2, 2019
@pschroen
Copy link
Member

pschroen commented Jun 2, 2019

Published [email protected]. Thanks again for the fix.

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