It was noticed that errors were being improperly reported when trying to debug the code. This was due to an issue with the esbuild configuration, and the babel plugin callbacks used during bundling.
It was noticed that any files that used babel to inline bySport or isSport configurations were being listed as unknown in the debugger. It was also noticed that these babel transformed files were unlisted within the debugger.
To solved this issue, a onResolve callback was added to the esbuild plugin function defined in the configuration.
Once the onResolve callback was added, we needed to make sure that the files being filtered by the callback were transformed properly.
To solve this problem, we added a namespace field to the onResolve callback result, and filtered files that passed through the onLoad callback to files within the namespace set during onResolve.
Finally, as good practice, dead code was removed from the onLoad callback.
Now that only certain files were being passed through the onLoad callback, we no longer need to check if the file should be babel transformed. We removed logic to filter out files to be transformed or not, since the only files coming through to the onLoad callback need to be transformed.
Summary
It was noticed that errors were being improperly reported when trying to debug the code. This was due to an issue with the esbuild configuration, and the babel plugin callbacks used during bundling.
See the discussion here
Description
It was noticed that any files that used babel to inline
bySport
orisSport
configurations were being listed asunknown
in the debugger. It was also noticed that these babel transformed files were unlisted within the debugger.To solved this issue, a
onResolve
callback was added to the esbuild plugin function defined in the configuration.Once the
onResolve
callback was added, we needed to make sure that the files being filtered by the callback were transformed properly.To solve this problem, we added a namespace field to the
onResolve
callback result, and filtered files that passed through theonLoad
callback to files within the namespace set duringonResolve
.Finally, as good practice, dead code was removed from the
onLoad
callback.Now that only certain files were being passed through the
onLoad
callback, we no longer need to check if the file should be babel transformed. We removed logic to filter out files to be transformed or not, since the only files coming through to the onLoad callback need to be transformed.Continuing the Discussion