Nitro does not respect module path (e.g. in monorepo) with target: server
Hey all!
When using Nitro with target: server
and a monorepo (see repo structure), the Nitro output does not include the correct path to the deps (e.g. un fetch polyfill)
Repo
- Install deps
yarn
- Build app
yarn build
- Check
packages/app/.output/server/index.js
. Here, the path is set correct (../../../../node_modules/@nuxt/un/runtime/polyfill/fetch.node.js
in our case) - Now check
packages/app/.output/server/nitro/server.js
. The path incorrect here - Same for
packages/app/.output/server/nitro/chunks/app/render.js
Expected path: require('../../../../../node_modules/@nuxt/un/runtime/polyfill/fetch.node.js');
Actual path: require('../../../../node_modules/@nuxt/un/runtime/polyfill/fetch.node.js');
When fixing the paths manually, the app runs as expected