element-plus [TypeScript] Element Plus makes eslint crash on typescript files

uyto3xhc  于 5个月前  发布在  TypeScript
关注(0)|答案(6)|浏览(67)

Bug Type: TypeScript

Environment

  • Vue Version: 3.3.4
  • Element Plus Version: 2.3.12
  • Browser / OS: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/116.0.0.0 Safari/537.36
  • Build Tool: Nuxt

Reproduction

  • N/A

Github Repo

Steps to reproduce

  • Clone the repo
  • pnpm install --frozen-lockfile
  • pnpm lint

What is Expected?

Eslint should report an unexpected console statement in test.ts .

What is actually happening?

Eslint crashes:

> eslint test.ts

<--- Last few GCs --->

[32000:000001BC1DB0BB50]    71136 ms: Mark-sweep 4052.6 (4140.0) -> 4038.6 (4142.1) MB, 1006.4 / 0.0 ms  (average mu = 0.203, current mu = 0.039) allocation failure; scavenge might not succeed
[32000:000001BC1DB0BB50]    73682 ms: Mark-sweep 4056.1 (4143.6) -> 4042.6 (4146.1) MB, 2509.2 / 0.0 ms  (average mu = 0.080, current mu = 0.015) allocation failure; scavenge might not succeed

<--- JS stacktrace --->

FATAL ERROR: Reached heap limit Allocation failed - JavaScript heap out of memory
 1: 00007FF7295807BF node_api_throw_syntax_error+175823
 2: 00007FF729505796 DSA_meth_get_flags+59654
 3: 00007FF729507480 DSA_meth_get_flags+67056
 4: 00007FF729FAE944 v8::Isolate::ReportExternalAllocationLimitReached+116
 5: 00007FF729F99CD2 v8::Isolate::Exit+674
 6: 00007FF729E1BB8C v8::internal::EmbedderStackStateScope::ExplicitScopeForTesting+124
 7: 00007FF729E18DAB v8::internal::Heap::CollectGarbage+3963
 8: 00007FF729E2EFE3 v8::internal::HeapAllocator::AllocateRawWithLightRetrySlowPath+2099
 9: 00007FF729E2F88D v8::internal::HeapAllocator::AllocateRawWithRetryOrFailSlowPath+93
10: 00007FF729E3F050 v8::internal::Factory::NewFillerObject+816
11: 00007FF729B2FF95 v8::internal::DateCache::Weekday+1349
12: 00007FF72A04BE71 v8::internal::SetupIsolateDelegate::SetupHeap+558193
13: 00007FF72A082344 v8::internal::SetupIsolateDelegate::SetupHeap+780612
14: 00007FF6AA79A2AB
 ELIFECYCLE  Command failed with exit code 134.

Additional comments

If you exclude '@element-plus/nuxt' in nuxt.config.ts , eslint works as designed. Therefore I assume element-plus causes this problem.

btxsgosb

btxsgosb2#

I have the same problem, however for me it is the Vue language server (Volar) that crashes whenever I include the @element-plus/nuxt package in my project.

xvw2m8pv

xvw2m8pv3#

I have the same problem

3duebb1j

3duebb1j4#

使用 PNPM 包管理器的情况下,element-plus 不适用于符号链接(isolated)依赖模型,要变更为(hoisted)没有符号链接、扁平的依赖模型。

修改 .npmrc 配置一下 npm,

# https://pnpm.io/zh/npmrc#node-linker
# element-plus 不适用于符号链接(isolated)依赖模型,所以变更为 hoisted
node-linker=hoisted

# https://pnpm.io/zh/npmrc#shamefully-hoist
# 相当于 `public-hoist-pattern=*`,具体参见 https://pnpm.io/zh/npmrc#public-hoist-pattern
shamefully-hoist=true

# https://pnpm.io/zh/npmrc#package-import-method
package-import-method=clone-or-copy

# https://docs.npmjs.com/cli/v10/using-npm/config#legacy-peer-deps
legacy-peer-deps=true

修改好之后,删除 node_modules 、依赖锁文件,如果 Nuxt 项目,可以将 .nuxt 一类文件都删除。

最后,重新安装依赖即可解决问题。

@some-user123

eqqqjvef

eqqqjvef5#

Sorry, but can you write in English?

shamefully-hoist is a bad idea (consider the name 😉).

6ovsh4lw

6ovsh4lw6#

Maybe you can try to add parameters to allocate memory.

"scripts": { "build": "NODE_OPTIONS=--max-old-space-size=4096 pnpm run -C internal/build start" }

相关问题