When a ms build is run like so
metalsmith
.env('NODE_ENV', undefined)
.use(jsBundle())
esbuild throws an error, halting the MS build
▲ [WARNING] "process.env.NODE_ENV" is defined as an identifier instead of a string (surround "undefined" with quotes to get a string) [suspicious-define]
<js>:1:34:
1 │ define: { 'process.env.NODE_ENV': 'undefined' }
│ ~~~~~~~~~~~
╵ '"undefined"'
This may be desirable when the define option is explicitly set, but is definitely unexpected when it's not. Solution is to replace the undefined value with the string undefined.