impossible to use any lodash version in production build

I'm trying to use lodash-es within a server/api route. example:
import merge from 'lodash-es/merge'
import merge from 'lodash-es/merge'
It works within npm run dev, but breaks within npm run build & npm run preview I'm getting the following error:
Nuxi 3.6.2
ℹ Node.js version: 20.4.0
ℹ Preset: node-server
ℹ Working dir: .output
ℹ Loading .env. This will not be loaded when running the server in production.
ℹ Starting preview command: node ./server/index.mjs

node:internal/process/esm_loader:46
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/root/app-nuxt/.output/server/node_modules/lodash-es/merge' imported from /root/app-nuxt/.output/server/index.mjs
Did you mean to import lodash-es/merge.js?
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:225:11)
Nuxi 3.6.2
ℹ Node.js version: 20.4.0
ℹ Preset: node-server
ℹ Working dir: .output
ℹ Loading .env. This will not be loaded when running the server in production.
ℹ Starting preview command: node ./server/index.mjs

node:internal/process/esm_loader:46
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module '/root/app-nuxt/.output/server/node_modules/lodash-es/merge' imported from /root/app-nuxt/.output/server/index.mjs
Did you mean to import lodash-es/merge.js?
at new NodeError (node:internal/errors:405:5)
at finalizeResolution (node:internal/modules/esm/resolve:225:11)
Already tried to use the lodash or lodash.merge packages instead. But same errors.
1 Reply
eyJOdnJHb25uYSI6Imd2VXVwIn0=
// @ts-ignore
import merge from 'lodash-es/merge.js'
// @ts-ignore
import merge from 'lodash-es/merge.js'
Want results from more Discord servers?
Add your server