unjs / nitro

Next Generation Server Toolkit. Create web servers with everything you need and deploy them wherever you prefer.
https://nitro.unjs.io
MIT License
5.89k stars 496 forks source link

Azure preset Cannot find module #2671

Closed n4an closed 1 month ago

n4an commented 1 month ago

Environment

node 18-21 bun bunx, npx

Reproduction

NITRO_PRESET=azure bun run build bunx @azure/static-web-apps-cli start .output/public --api-location .output/server

Describe the bug

Worker was unable to load function functions: 'Cannot find module '/home/nuxt/.output/server/functions/node_modules/@xxx/xxx/xxx' imported from /home/nuxt/.output/server/functions/index.mjs

Did you mean to import "@xxx/xx/xx/xxx.js"?'

Additional context

Also that NITRO_PRESET=azure npx nypm@latest build not work

Unknown command build

In past I remember I was able to run that and not remember something about nypm What I do again wrong? Some problem with tsconfig?

Logs

No response

n4an commented 1 month ago

I remember what was my problem and eliminated it and all again work well. I imported file import { blaBla } from '@some-package/name/file-name' but it work well if I add that file to package index.ts and import it like import { blaBla } from @some-package/name.