Terser plugin: "Export" statement may only appear at the top level, plus other compilation issues

Honestly, I’m having the hardest time porting over some pretty basic javascript from a sage 9 project into Sage 10 using Bud.

We’ve seemingly almost got this squared away, but when trying to import throttle from lodash/throttle or destructured from lodash-es, we’re getting issues with the import.

From lodash-es:

│ "Export" statement may only appear at the top level [vendor/app.9ba5a4.js:3256,0]

From lodash, in the devtools console

If I don’t import lodash at all, I get an error that $ is not defined, despite having set my externals in bud.config.js

app
   .externals({
     jquery: 'window.jQuery',
     $: 'window.jQuery',
   })

I’m honestly at a loss for what I’m doing wrong, here. I’ve tried adding extensions that seem like they should get this all working, but I’m just spinning in circles, here. Any advice would be appreciated.