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

Fails to compile GLSL with quotes in the comments #164

Open
shamansir opened this issue Jan 10, 2019 · 0 comments
Open

Fails to compile GLSL with quotes in the comments #164

shamansir opened this issue Jan 10, 2019 · 0 comments

Comments

@shamansir
Copy link

Elm v0.19.

While elm make works and compiles this GLSL code (it uses elm-explorations/webgl, see examples there), elm-webpack-loader fails to run it:

fragmentShader : WebGL.Shader {} Uniforms { vcolor : Vec3 }
fragmentShader =
    [glsl|

        precision mediump float;
        varying vec3 vcolor;

        // foo'bar
        void main () {
            gl_FragColor = vec4(vcolor, 1.0);
        }

    |]

If I change // foo'bar to // foobar, webpack compilation works good. There is also the similar error for multi-line shader comment like /* foo'bar */.

The error for // foo'bar case is:

ERROR in ./src/Main.elm 16987:94
Module parse failed: Expecting Unicode escape sequence \uXXXX (16987:94)
You may need an appropriate loader to handle this file type.
| 	});
| var author$project$Layer$Template$fragmentShader = {
> 	src: '\n\n        precision mediump float;\n        varying vec3 vcolor;\n        // foo'bar\n\n        void main () {\n            gl_FragColor = vec4(vcolor, 1.0);\n        }\n\n    ',
| 	attributes: {},
| 	uniforms: {}
 @ ./index.js 17:12-37
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./index.js
ℹ 「wdm」: Failed to compile.

The error for /* foo'bar */ case is:

ERROR in ./src/Main.elm 16987:90
Module parse failed: Unexpected token (16987:90)
You may need an appropriate loader to handle this file type.
| 	});
| var author$project$Layer$Template$fragmentShader = {
> 	src: '\n\n        precision mediump float;\n        varying vec3 vcolor;\n        /* foo'bar */\n\n        void main () {\n            gl_FragColor = vec4(vcolor, 1.0);\n        }\n\n    ',
| 	attributes: {},
| 	uniforms: {}
 @ ./index.js 17:12-37
 @ multi (webpack)-dev-server/client?http://localhost:8080 ./index.js
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

No branches or pull requests

1 participant