# Custom shaders compile error in Electron?

**URL:** <https://forum.babylonjs.com/t/custom-shaders-compile-error-in-electron/58592>\
**Category:** Questions\
**Created:** [May 21, 2025, 9:05pm UTC](https://forum.babylonjs.com/t/custom-shaders-compile-error-in-electron/58592 "2025-05-21T21:05:29Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![chbaby](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/chbaby/32/46452_2.png) [@chbaby](https://forum.babylonjs.com/u/chbaby)\
**Post date:** [May 21, 2025, 9:05pm UTC](https://forum.babylonjs.com/t/custom-shaders-compile-error-in-electron/58592/1 "2025-05-21T21:05:29Z")

</div>

Hello, I added some babylon.js code to my electron project. Things work as expected EXCEPT any custom coded shaders whether it be a ShaderMaterial or a Material Plugin fail to compile.

I’m wondering if it is maybe a shader language problem.

I already fixed the CSP issues as far as I know.

One strange thing is I am getting this error in the console:

```auto
PresetPreview.tsx:70 BJS - [04:02:39]: #version 300 es
#define WEBGL2 
#define NUM_BONE_INFLUENCERS 0
#define NUM_MORPH_INFLUENCERS 0
#define SHADER_NAME fragment:cssBlendShader
precision highp float;
<!doctype html>
<html>
<head>
<script type="module" src="/@vite/client"></script>
<meta charset="UTF-8" />
<title>Electron</title>
(the rest of my index.html)

```

It is like the shader code is including part of my index.html file?

---

<div class="post-metadata">

**Author:** ![chbaby](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/chbaby/32/46452_2.png) [@chbaby](https://forum.babylonjs.com/u/chbaby)\
**Post date:** [May 22, 2025, 3:14am UTC](https://forum.babylonjs.com/t/custom-shaders-compile-error-in-electron/58592/2 "2025-05-22T03:14:00Z")

</div>

OK, the index.html thing was because I forgot to include the module that set the `BABYLON.Effect.ShadersStore`.

But I am still getting errors like:

```auto
PresetPreview.tsx:70 BJS - [10:09:40]: Error: VERTEX SHADER ERROR: 0:17: 'uniform' : only allowed at global scope
ERROR: 0:17: 'uniform' : Local variables can only use the const storage qualifier.
ERROR: 0:17: 'uniform' : invalid qualifier combination

```

when the exact same shader code is working in my web application.

I don’t know what is causing the issue in Electron.

I have confirmed that WebGL2 is being used from `engine.webGLVersion` outputting 2

---

<div class="post-metadata">

**Author:** ![chbaby](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/chbaby/32/46452_2.png) [@chbaby](https://forum.babylonjs.com/u/chbaby)\
**Post date:** [May 22, 2025, 3:42am UTC](https://forum.babylonjs.com/t/custom-shaders-compile-error-in-electron/58592/3 "2025-05-22T03:42:37Z")

</div>

Nevermind, I figured it out. There were some #ifdefs in my shader code that triggered incorrectly.

---

<div class="post-metadata">

**Author:** ![roland](https://sea2.discourse-cdn.com/flex024/user_avatar/forum.babylonjs.com/roland/32/38940_2.png) [@roland](https://forum.babylonjs.com/u/roland)\
**Post date:** [May 22, 2025, 8:24am UTC](https://forum.babylonjs.com/t/custom-shaders-compile-error-in-electron/58592/5 "2025-05-22T08:24:38Z")

</div>

Hey, thanks a lot for sharing the solution! It’s always super helpful when someone circles back and posts how they solved it. Really appreciate it — makes it easier for others to find answers!
