Relative imports are broken
juliendargelos opened this issue · comments
Relative imports are broken due to unspecified glslify basedir
option:
src/shaders/pbr/fragment.glsl
// ...
#pragma glslify: SRGBToLinear = require('../math/srgb-to-linear.glsl')
// ...
src/shaders/math/srgb-to-linear.glsl
// ...
#pragma glslify: export(SRGBtoLinear)
Output of vite build
command:
[vite-plugin-glslify:files] Cannot find module '../math/srgb-to-linear.glsl' from './node_modules/vite-plugin-glslify/dist'
file: ./src/shaders/pbr/fragment.glsl
error during build:
Error: Cannot find module '../math/srgb-to-linear.glsl' from './node_modules/vite-plugin-glslify/dist'
at Function.module.exports [as sync] (./node_modules/glsl-resolve/node_modules/resolve/lib/sync.js:32:11)
at Depper.resolveSync [as resolve] (./node_modules/glsl-resolve/index.js:33:19)
at ./node_modules/glslify-deps/sync.js:156:27
at Array.forEach (<anonymous>)
at resolveImports (./node_modules/glslify-deps/sync.js:149:13)
at Depper.add (./node_modules/glslify-deps/sync.js:128:3)
at Depper.inline (./node_modules/glslify-deps/sync.js:55:15)
at Object.compile (./node_modules/glslify/index.js:47:23)
at module.exports.compile (./node_modules/glslify/index.js:22:18)
at Object.transform (./node_modules/vite-plugin-glslify/dist/index.js:41:64)