NuxtN
Nuxt2y ago
1 reply
Fleny

Nitro build warning on ESM and this

Hi, when trying to build my application after Nuxt logs Building Nuxt Nitro server (preset: node-server) i get a bunch of warnings from files in the node_modules (specificly files from arktype and @arktype/schema) like these:
node_modules/.pnpm/arktype@2.0.0-dev.25/node_modules/arktype/out/scope.js (1:25): The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
[...]
node_modules/.pnpm/@arktype+schema@0.1.17/node_modules/@arktype/schema/out/roots/alias.js (8:28): The 'this' keyword is equivalent to 'undefined' at the top level of an ES module, and has been rewritten
(there a bunch of them, it would be too long to list them all)

Checking the arktype build output it has the TS helpers that TSC would emit and those use this that ESBuild(?) seems to not be so happy with

The built server seems to work fine, however the warns are a bit annoying. Also another thing that is quite strange, while i can get the warns when using Windows, trying in WSL and StackBlitz it does not warn.

pnpm nuxi info:
- Operating System: Windows_NT
- Node Version:     v22.2.0
- Nuxt Version:     3.12.2
- CLI Version:      3.12.0
- Nitro Version:    2.9.6
- Package Manager:  pnpm@9.3.0
- Builder:          -
- User Config:      devtools
- Runtime Modules:  -
- Build Modules:    -


repro repo: https://github.com/Fleny113/arktype-nuxt-repro (the server/api/test.post.ts file has the arktype validation)
Was this page helpful?