visjs/ngx-vis

Angular 8.2.12

adr75 opened this issue · 15 comments

adr75 commented

Hello,
Can you confirm that it is supposed to work with Angular 8.2.12?

When I try to build the app after adding the ngx-vis package, and copy pasting the code from timeline demo, I got a lot of errors:

`ERROR in ../node_modules/vis-network/declarations/index-legacy.d.ts:13:23 - error TS2307: Cannot find module 'vis-util/esnext'.

13 import * as util from "vis-util/esnext";
~~~~~~~~~~~~~~~~~
../node_modules/vis-network/declarations/index-legacy.d.ts:15:23 - error TS2307: Cannot find module 'vis-data/esnext'.

15 import * as data from "vis-data/esnext";
~~~~~~~~~~~~~~~~~
../node_modules/vis-network/declarations/index-legacy.d.ts:17:42 - error TS2307: Cannot find module 'vis-data/esnext'.

17 export { DataSet, DataView, Queue } from "vis-data/esnext";
~~~~~~~~~~~~~~~~~
../node_modules/vis-network/declarations/index-legacy.d.ts:18:25 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

18 import * as moment from "./module/moment";
~~~~~~~~~~~~~~~~~
../node_modules/vis-network/declarations/index-legacy.d.ts:20:25 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

20 import * as Hammer from "./module/hammer";
~~~~~~~~~~~~~~~~~
../node_modules/vis-network/declarations/index-legacy.d.ts:22:27 - error TS2307: Cannot find module 'keycharm'.

22 import * as keycharm from "keycharm";
~~~~~~~~~~
../node_modules/vis-network/declarations/module/hammer.d.ts:1:20 - error TS2307: Cannot find module '@egjs/hammerjs'.

1 import hammer from '@egjs/hammerjs'
~~~~~~~~~~~~~~~~
../node_modules/vis-network/declarations/module/moment.d.ts:1:20 - error TS2307: Cannot find module 'moment'.

1 import moment from 'moment'
~~~~~~~~
../node_modules/vis-network/declarations/network/Network.d.ts:19:50 - error TS2307: Cannot find module 'vis-data'.

19 import { DataInterface, DataSet, DataView } from 'vis-data';
~~~~~~~~~~
../node_modules/vis-timeline/declarations/index.d.ts:19:50 - error TS2307: Cannot find module 'vis-data'.

19 import { DataInterface, DataSet, DataView } from 'vis-data';
~~~~~~~~~~
../node_modules/vis-timeline/declarations/index.d.ts:27:64 - error TS2307: Cannot find module 'moment'.

27 import { MomentInput, MomentFormatSpecification, Moment } from 'moment';
~~~~~~~~`

When I try to install the missing module, I got this:

../node_modules/vis-network/declarations/index-legacy.d.ts:20:25 - error TS2497: This module can only be referenced with ECMAScript imports/exports by turning on the 'allowSyntheticDefaultImports' flag and referencing its default export.

Thanks!
Adrien

can you post your package.json?

I'm seeing the exact same error as above. However, if I downgrade to ngx-vis: 3.0.2 everything works fine. Also, I already have allowSyntheticDefaultImports set in my tsconfig.json and that error still shows up in ngx-vis 3.0.3+.

adr75 commented

can you post your package.json?

Here it is: package.json.txt

thanks to @keforbes, downgrading to v3.0.2 works for Angular 10

could you give ngx-vis@3.1.0-build1603138697 a try?

Using build ngx-vis@3.1.0-build1603138697 I'm getting the following error:

WARNING in Entry point 'ngx-vis' contains deep imports into '/my_project/node_modules/vis-network/esnext', '/my_project/node_modules/vis-timeline/esnext'. This is probably not a problem, but may cause the compilation of entry points to be out of order.

ERROR in The target entry-point "ngx-vis" has missing dependencies:
 - vis-data/esnext

I have the same problem

Angular 11, downgraded to 3.0.2 and still need some modifications:
set

   "esModuleInterop": true,
    "allowSyntheticDefaultImports": true,

in tsconfig.json

you can give "ngx-vis@3.1.0-build1627370228" a try

you can give "ngx-vis@3.1.0-build1627370228" a try

esnext no longer breaks compilation, now keycharm does.

btw. esModuleInterop & allowSyntheticDefaultImports are still mandatory.

node_modules/vis-network/declarations/index-legacy.d.ts:22:27 - error TS7016: Could not find a declaration file for module 'keycharm'.

did you installed the peer dependencies?
Can you post your package.json?

package.txt
npm.txt

I init a brand new repo, and upgrade npm to 7.2.1

node version: v16.4.1
npm version: 7.21.1
angular version: 11.2.14
ngx-vis version: 3.1.0-build1627370228

When I tried to switch back to 3.0.2, now it's even fail to install:

"C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" install --scripts-prepend-node-path=auto
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: stone-web@0.0.0
npm ERR! Found: vis-util@4.3.4
npm ERR! node_modules/vis-util
npm ERR!   peer vis-util@"^4.0.0" from vis-data@6.6.1
npm ERR!   node_modules/vis-data
npm ERR!     peer vis-data@"^6.2.3" from ngx-vis@3.0.2
npm ERR!     node_modules/ngx-vis
npm ERR!       ngx-vis@"3.0.2" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer vis-util@"^2.0.1" from ngx-vis@3.0.2
npm ERR! node_modules/ngx-vis
npm ERR!   ngx-vis@"3.0.2" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See C:\Users\nbxx\AppData\Local\npm-cache\eresolve-report.txt for a full report.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\nbxx\AppData\Local\npm-cache\_logs\2021-08-27T13_49_55_903Z-debug.log

Any solution for this ? Its also failing for angular 13 in build phase with 3.0.2

a new preview is available via npm i ngx-vis@next

Otherwise track issues please here #457