question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Dependency @antv/g6 is attempting to import Node built-in module util.

See original GitHub issue

https://github.com/antvis/G6/blob/06da73019d1a6ca8e7481b4229cb85980d966557/src/plugins/timeBar/path.ts#L4

Consider import from @antv/util instead. As a front-end library there shouldn’t be any dependencies from nodejs.


BTW, vite’s rollup will show error:

Illegal reassignment to import 'mat3'
Illegal reassignment to import 'vec2'

But I haven’t find out which file causes this issue. Maybe related #2254.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:16 (6 by maintainers)

github_iconTop GitHub Comments

2reactions
hyriouscommented, Nov 25, 2020

Ok, I found a way to get a more detailed error log by using rollup, steps:

echo '{"private":true}' > package.json
npm install -D rollup @rollup/plugin-commonjs @rollup/plugin-node-resolve
npm install @antv/g6

rollup.config.js

import resolve from '@rollup/plugin-node-resolve';
import commonjs from '@rollup/plugin-commonjs';

export default {
  input: 'a.js',
  output: { format: 'es' },
  plugins: [resolve(), commonjs()]
};

a.js

export * as G6 from "@antv/g6"

rollup!

npx rollup -c rollup.config.js

outputs

(!) Illegal reassignment to import 'mat3'
node_modules\@antv\matrix-util\esm\mat3.js: (2:0)
1: import * as mat3 from '@antv/gl-matrix/lib/gl-matrix/mat3';
2: mat3.translate = function (out, a, v) {
   ^
3:     var transMat = new Array(9);
...

It looks like your esm bundle result is not sound to rollup. Also,

Error: 'ISystem' is not exported by node_modules\@antv\g-webgpu-core\es\ISystem.js, imported by node_modules\@antv\g-webgpu-core\es\index.js

(I guess should we edit the issue title to ‘can not use rollup to bundle this module’ or raise a new issue?)

1reaction
csouchetcommented, Jan 28, 2021

I also have this error when I configure Rollup to use only the ES6 module of G6 (Version 4.1.4).

The file node_modules/@antv/g-webgpu-core/es/ISystem.js is empty, but the file node_modules/@antv/g-webgpu-core/es/ISystem.d.ts export the interface ISystem.

Read more comments on GitHub >

github_iconTop Results From Across the Web

SyntaxError: Cannot use import statement outside a module
But that gets me another error: "Error: Plugin/Preset files are not allowed to export objects, only functions." Here are the dependencies I ...
Read more >
@antv/g6-element - npm
Start using @antv/g6-element in your project by running `npm i ... Abundant Built-in Items: Nodes and edges with free configurations; ...
Read more >
skyline-console/yarn.lock at master - OpenDev
skyline-console - A modern dashboard for OpenStack - UI.
Read more >
group org.webjars.npm - javalibs
Indexing of new Maven dependencies and their versions has been stopped already. ... @babel/helper-module-imports, jar, babel__helper-module-imports.
Read more >
Getting Started - G6 Graph Visualization Engine | AntV
Step 2: Import the JS file to the file where G6 is going to be used: ... The properties of node and edge...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found