Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug report] Endless loop in resolveSSRExternal in monorepo #2635

Closed
3 tasks done
meteorlxy opened this issue Mar 22, 2021 · 0 comments · Fixed by #2636
Closed
3 tasks done

[Bug report] Endless loop in resolveSSRExternal in monorepo #2635

meteorlxy opened this issue Mar 22, 2021 · 0 comments · Fixed by #2636

Comments

@meteorlxy
Copy link
Contributor

⚠️ IMPORTANT ⚠️ Please do not ignore this template. If you do, your issue will be closed immediately.

Describe the bug

When using vite in monorepo, resolveSSRExternal might cause endless loop and then "Maximum call stack size exceeded".

Reproduction

Related codes:

const deps = [...knownImports, ...Object.keys(pkg.dependencies || {})]

resolveSSRExternal(
{
...config,
root: depRoot
},
knownImports,
ssrExternals
)

If the monorepo dependency appears in the knownImports, then it will be forwared to next resolveSSRExternal call and loop forever.

That can reproduce in vuepress-next repo:

yarn
yarn copy && yarn build
yarn docs:dev

System Info

  • vite version: 2.1.2
  • Operating System: Linux
  • Node version: 12.16.1
  • Package manager (npm/yarn/pnpm) and version: yarn 1.22.4

Logs (Optional if provided reproduction)

[vite] error while updating dependencies:
RangeError: Maximum call stack size exceeded
    at Function.resolveSync [as sync] (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/resolve/lib/sync.js:90:53)
    at resolveFrom$2 (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:3883:29)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32155:51)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32156:13)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32156:13)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32156:13)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32156:13)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32156:13)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32156:13)
    at resolveSSRExternal (/data/meteorlxy/projects/@vuepress/vuepress-next/node_modules/vite/dist/node/chunks/dep-efe32886.js:32156:13)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants