function prepShaderSource(shaderSource) {
  var lineOffset = 0;

  if (spaceRE.test(shaderSource)) {
    lineOffset = 1;
    shaderSource = shaderSource.replace(spaceRE, '');
  }

  return {
    lineOffset: lineOffset,
    shaderSource: shaderSource
  };
}
Remove the first end of line because WebGL 2.0 requires
#version 300 es
as the first line. No whitespace allowed before that line
so

<script>
#version 300 es
</script>

Has one line before it which is invalid according to GLSL ES 3.00

@param {string} shaderSource The source of the shader
@returns {{shaderSource: string, lineOffset: number}}
@private