elm-webpack-loader
elm-webpack-loader copied to clipboard
Fails to compile GLSL with quotes in the comments
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