We’ve run into an issue where use of Math.abs is causing the build task to fail silently, generating only a subset of our components. The issue is similar to what is described in #114, but it not only stops JS compilation: a handful of components (their templates, stylesheets, even their directories) are entirely omitted from compilation and the build task completes “successfully”. Removing the offending line consistently causes the previously missing components to be compiled correctly.
Possible root cause
I believe the issue is that gulp-babel (or, more precisely, @babel/minify) is emitting an error, but because there is no handling in emulsify-gulp, we never hear of it. Since this project uses Gulp pre-v4 (which does not fail on thrown errors), the task fails silently. I suspect a failure of the scripts task is causing the pl:full task to stop rendering components because tasks are run in parallel the way they are declared here, but I could be wrong about that. What I can say for sure is that removing Math.abs from the offending JS file results in correctly-compiled components, and re-introducing Math.abs consistently causes the problem to arise.
Proposed solution
Logging the error to the console would, at the very least, make the problem more visible. Ideally, however, we would find a way to surface the error by exiting with a non-zero code, at least in the case of the build task (I realize this would be annoying in the theme task, though we should at least be logging bright red errors to the console in that case).
We’ve run into an issue where use of
Math.absis causing thebuildtask to fail silently, generating only a subset of our components. The issue is similar to what is described in #114, but it not only stops JS compilation: a handful of components (their templates, stylesheets, even their directories) are entirely omitted from compilation and thebuildtask completes “successfully”. Removing the offending line consistently causes the previously missing components to be compiled correctly.Possible root cause
I believe the issue is that
gulp-babel(or, more precisely,@babel/minify) is emitting an error, but because there is no handling inemulsify-gulp, we never hear of it. Since this project uses Gulp pre-v4 (which does not fail on thrown errors), the task fails silently. I suspect a failure of thescriptstask is causing thepl:fulltask to stop rendering components because tasks are run in parallel the way they are declared here, but I could be wrong about that. What I can say for sure is that removingMath.absfrom the offending JS file results in correctly-compiled components, and re-introducingMath.absconsistently causes the problem to arise.Proposed solution
Logging the error to the console would, at the very least, make the problem more visible. Ideally, however, we would find a way to surface the error by exiting with a non-zero code, at least in the case of the
buildtask (I realize this would be annoying in thethemetask, though we should at least be logging bright red errors to the console in that case).