gpujs / gpujs/gpu.js

create-react-app minify step of build is causing errors at run time

Open
#642 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
15.5k
Forks
663
PR merge metrics
No merged PRs in 30d

Description

## *What* is wrong?
Code which is working in an un-minified development environment is crashing after creating a build via create-react-app, where the code has been minified and uglified

## *Where* does it happen?
gpu.js 2.10.4

The code which I create inside of the gpu.createKernel function

## *How* do we replicate the issue?
### Download source code
- git clone https://github.com/RossKinsella/gpujs-crash

### See it working in dev environment
- yarn start
- open localhost:3000
- open your browser console
- click the button, you will see the expected output in the console

### See it breaking in a build
- yarn build
- yarn global add serve
- serve -s build
- open localhost:5000
- open your browser console
- click the button, you will see the following error in the console:
```
2.dbc4db3a.chunk.js:2 Uncaught Error: Error compiling fragment shader: ERROR: 0:471: 'assign' : cannot convert from 'bool' to 'lowp float'
ERROR: 0:471: '&&' : wrong operand types - no operation '&&' exists that takes a left-hand operand of type 'lowp float' and a right operand of type 'bool' (or there is no acceptable conversion)
ERROR: 0:484: '&&' : wrong operand types - no operation '&&' exists that takes a left-hand operand of type 'bool' and a right operand of type 'lowp 2-component vector of float' (or there is no acceptable conversion)
```

## *How* important is this (1-5)?
5

## Expected behavior (i.e. solution)
For the build step to not break the code

## Other Comments
Thanks for your hard work on this project.

I spent a few hours looking over the other issues related to minify problems, I think I am running into some other edge case here.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.