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

SSR doesn't work with lodash-es #2060

Closed
3 tasks done
07akioni opened this issue Feb 17, 2021 · 1 comment
Closed
3 tasks done

SSR doesn't work with lodash-es #2060

07akioni opened this issue Feb 17, 2021 · 1 comment
Labels
bug: upstream Bug in a dependency of Vite

Comments

@07akioni
Copy link
Contributor

07akioni commented Feb 17, 2021

⚠️ IMPORTANT ⚠️ Please check the following list before proceeding. If you ignore this issue template, your issue will be directly closed.

  • Read the docs.
  • Use Vite >=2.0. (1.x is no longer supported)
  • If the issue is related to 1.x -> 2.0 upgrade, read the Migration Guide first.

Describe the bug

vue-ssr demo doesn't work with a simple lodash-es import.

Reproduction

# at root of vite git repo

cd packages/playground/ssr-vue

# Do setups

npm i -D lodash-es

# Edit src/pages/Home.vue
// Home.vue (changed parts)
<script setup>
import { upperFirst } from 'lodash-es' // <- 1
import foo from '@foo'
import { reactive, defineAsyncComponent } from 'vue'
const Foo = defineAsyncComponent(() => import('../components/Foo').then(mod => mod.Foo))

const state = reactive({ count: 0 })
console.log(upperFirst('star kirby')) // <- 2
</script>

System Info

  • vite version: 2.0.1
  • Operating System: Mac OS
  • Node version: v12.16.1
  • Package manager (npm/yarn/pnpm) and version: npm 7.5.4, yarn 1.22.10

Logs (Optional if provided reproduction)

  1. Run vite or vite build with the --debug flag.
  2. Provide the error log here.

image

npm run dev

> test-ssr-vue@0.0.0 dev
> node server

Pre-bundling dependencies:
  vue
  vue-router
  lodash-es
(this will be run only when your dependencies or config have changed)
http://localhost:3000
[@vue/compiler-sfc] <script setup> is still an experimental proposal.
Follow its status at https://github.com/vuejs/rfcs/pull/227.

[@vue/compiler-sfc] When using experimental features,
it is recommended to pin your vue dependencies to exact versions to avoid breakage.

[Vue Router warn]: Error: EMFILE: too many open files, open '/Users/hrsonion/Development/Dev2021/vite/node_modules/lodash-es/_freeGlobal.js'
Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 4)
(node:62634) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the future, promise rejections that are not handled will terminate the Node.js process with a non-zero exit code.
[Vue Router warn]: Error: EMFILE: too many open files, open '/Users/hrsonion/Development/Dev2021/vite/node_modules/lodash-es/_baseIsEqualDeep.js'
Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 8)
[Vue Router warn]: Error: EMFILE: too many open files, open '/Users/hrsonion/Development/Dev2021/vite/node_modules/lodash-es/_Hash.js'
Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 12)
[Vue Router warn]: Error: EMFILE: too many open files, open '/Users/hrsonion/Development/Dev2021/vite/node_modules/lodash-es/_createCtor.js'
Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Error: Couldn't resolve component "default" at "/"
    at /Users/hrsonion/Development/Dev2021/vite/packages/playground/ssr-vue/node_modules/vue-router/dist/vue-router.cjs.js:1979:47
(node:62634) UnhandledPromiseRejectionWarning: Unhandled promise rejection. This error originated either by throwing inside of an async function without a catch block, or by rejecting a promise which was not handled with .catch(). To terminate the node process on unhandled promise rejection, use the CLI flag `--unhandled-rejections=strict` (see https://nodejs.org/api/cli.html#cli_unhandled_rejections_mode). (rejection id: 16)
@yyx990803
Copy link
Member

This is partially fixed by a763ffd

However, lodash-es currently will cause another issue during SSR build - which technically is a Rollup bug: rollup/rollup#3969

@yyx990803 yyx990803 added bug: upstream Bug in a dependency of Vite and removed pending triage labels Feb 22, 2021
@yyx990803 yyx990803 reopened this Feb 22, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 16, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug: upstream Bug in a dependency of Vite
Projects
None yet
Development

No branches or pull requests

2 participants