util icon indicating copy to clipboard operation
util copied to clipboard

Error import module with TypeScript

Open cavargasl opened this issue 3 years ago • 8 comments

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

cavargasl avatar Dec 12 '22 16:12 cavargasl

im having same issue

anabel29 avatar Dec 14 '22 22:12 anabel29

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

ghost avatar Dec 15 '22 09:12 ghost

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

elderdog avatar Dec 16 '22 08:12 elderdog

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

changjunhao avatar Dec 31 '22 05:12 changjunhao

Still no solution??

nyakaz73 avatar Jan 30 '23 15:01 nyakaz73

I'm also looking for a solution to this

giuseppe-dblue avatar Feb 24 '23 14:02 giuseppe-dblue

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.

phymo avatar Mar 08 '23 07:03 phymo

I hava this problem too

FinnWu avatar Apr 10 '23 10:04 FinnWu