antvis/G6

Do you want to work on this issue?

You can request for a bounty in order to promote it!

angular构建G6时Type expected问题 #5638

Yyoneqweqwe posted onGitHub

在angular中启动G6 image

  • 我查的是要升级TS版本,升级到typescript@4.2.4说是可以解决问题,但是升级后 1712893188301

又出现了这个问题,有大佬知道更好的解决方法


<!-- Answer -->

To address the TypeScript compilation errors and memory allocation issues you're encountering with G6 in Angular, consider the following steps:

  1. Upgrade TypeScript: Ensure your TypeScript version matches the one used by G6. If G6 is using a newer version, such as 5.3.3, upgrading to this version might resolve the type-related errors.

  2. Increase Node.js Memory Limit: The memory allocation error (ENOMEM) suggests the TypeScript compiler is running out of memory. Increase the memory limit by setting the NODE_OPTIONS environment variable. For a 4 GB limit, use:

    export NODE_OPTIONS=--max_old_space_size=4096
  3. Optimize TypeScript Compilation: Modify your tsconfig.json to include "incremental": true under compilerOptions. This optimizes the compilation process by reusing information from previous compilations, reducing memory usage and speeding up build times.

Here's an example snippet for your tsconfig.json:

{
  "compilerOptions": {
    ...
    "incremental": true,
    ...
  }
}

These steps are targeted solutions based on the issues you've described. Upgrading TypeScript can help with compatibility and type errors, while adjusting the Node.js memory limit and optimizing the TypeScript compiler settings can mitigate memory allocation issues during the build process.

Sources

<!-- Dosu Comment Footer -->

<details open> <summary>

About Dosu

</summary>

This response is meant to be useful and save you time. It is not meant to be a precise solution, but rather a starting point for your own research.

Help me be more useful! Please leave a 👍 if this is helpful and 👎 if it is irrelevant.

If you want to continue the conversation, start your reply with @dosu-bot.

</details>

posted by dosubot[bot] about 1 year ago

这个感觉是 ts 版本问题吧。

posted by hustcc about 1 year ago

这是感觉版本问题吧。

是ts版本问题,提升typescript版本但是超出了包的范围,版本低了又运行不了

posted by Yyoneqweqwe about 1 year ago

确认下你的 angular 版本呢,要求 < 4.0.0 挺奇怪的,这个版本应该比较旧了吧

posted by Aarebecca about 1 year ago

确认下你的角度版本呢,要求 < 4.0.0 应该挺奇怪的,这个版本比较旧吧 1712901772784 10.0.4的版本,跟这个有关嘛?

posted by Yyoneqweqwe about 1 year ago

Fund this Issue

$0.00
Funded
Only logged in users can fund an issue

Pull requests