antvis / util

utility library for AntV products.
MIT License
74 stars 27 forks source link

Error import module with TypeScript #99

Closed cavargasl closed 2 months ago

cavargasl commented 1 year ago

in this section from 'node_module/@antv/g-base/lib/animate/timeline.js'

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var d3Timer = require("d3-timer");
var d3_interpolate_1 = require("d3-interpolate"); // 目前整体动画只需要数值和数组的差值计算

show Error [ERR_REQUIRE_ESM] using SSR Here is the detail of the error image

could be changed to to correct it

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var util_1 = require("@antv/util");
var d3Timer = require("d3-timer");
const d3_interpolate_1 = async () => {
    const { interpolate } = await import("d3-interpolate");
    return interpolate;
};

node 18.12.1

anabel29 commented 1 year ago

im having same issue

ghost commented 1 year ago

im having same issue, but "name": "@antv/g-base", "version": "0.5.11" is ok

elderdog commented 1 year ago

I'm having the same issue, guess it's because of this update https://github.com/antvis/G2/issues/4423#issuecomment-1343937049 I'm using "@antv/g2 version4.2.8", it worked well, but since I reinstalled my dependencies, it showed me the same error The nested dependency of "@antv/g2 version4.2.8" updated the major version, I can not solve this situation by locking version of @antv/g2 So, looking forward to a solution

changjunhao commented 1 year ago

I'm having the same issue. So, looking forward to a solution

nyakaz73 commented 1 year ago

Still no solution??

giuseppe-dblue commented 1 year ago

I'm also looking for a solution to this

phymo commented 1 year ago

Do you really want it to run on server side?

  1. if yes, maybe you should transpile dependencies. for example in vue3. you can add below to vue.config.js; transpileDependencies: ["@antv/*"]
  2. if no, maybe you can just import the lib only in client side. for example, only import in mounted hooks.
FinnWu commented 1 year ago

I hava this problem too

hustcc commented 2 months ago

d3 的包全部锁定 2 版本,我们现在业务中也只能这么做。