visjs / ngx-vis

An angular 5+ vis.js project
https://visjs.github.io/ngx-vis
MIT License
69 stars 31 forks source link

Error building project #384

Closed ricardomga closed 4 years ago

ricardomga commented 4 years ago

Current Behavior

Exception when building my project

Failure Information

ERROR in node_modules/vis-network/dist/types/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.

Steps to Reproduce

  1. npm i --save ngx-vis
  2. npm i --save @types/vis
  3. import { VisModule } from 'ngx-vis'
  4. npm run build

Context

ricardomga commented 4 years ago

I don't need the legacy part, is there any way to exclude it?

hypery2k commented 4 years ago

could you try the latest released version?

meyerhp commented 4 years ago

I am having the same issue,

ngx-vis: 3.0.3 @types/vis: 4.21.19 Angular version: 8.2.8 NodeJS version: 12.14.1 Operating System: macOS Mojave

hypery2k commented 4 years ago

did you also installed @types/vis Do you have a sample repo?

j-frost commented 4 years ago

I too have this issue. I had @types/vis installed, but I removed it, seeing as how you provide your own typings for all the things I've needed so far. My project is pretty much exactly your demo currently (the one in this repo), except all the content is in a mat-sidenav-content router outlet.

edit: So I got it to work. A little. Even when it compiles, the resulting timeline (again, from the example data used here) looks like this:

image

I imagine there's some CSS missing?

wisespace-io commented 4 years ago

I have similar issue

ngx-vis: 3.0.4 Angular version: 8.2.14

../node_modules/vis-network/dist/types/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.

But also it did not install the peer dependencies:

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

ERROR in ../node_modules/vis-network/dist/types/index-legacy.d.ts:15:23 - error TS2307: Cannot find module 'vis-data'.

hypery2k commented 4 years ago

could you post your package.json ?

wisespace-io commented 4 years ago

Yes, however you can easily reproduce if you create a brand new project with the command below and add the library

ng new timeline-app npm i ngx-vis

Import the library in app.module.ts

import { VisModule } from 'ngx-vis'

package.json


{
  "name": "timeline-app",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "test": "ng test",
    "lint": "ng lint",
    "e2e": "ng e2e"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "~8.2.14",
    "@angular/common": "~8.2.14",
    "@angular/compiler": "~8.2.14",
    "@angular/core": "~8.2.14",
    "@angular/forms": "~8.2.14",
    "@angular/platform-browser": "~8.2.14",
    "@angular/platform-browser-dynamic": "~8.2.14",
    "@angular/router": "~8.2.14",
    "ngx-vis": "^3.0.4",
    "rxjs": "~6.4.0",
    "tslib": "^1.10.0",
    "zone.js": "~0.9.1"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "~0.803.25",
    "@angular/cli": "~8.3.25",
    "@angular/compiler-cli": "~8.2.14",
    "@angular/language-service": "~8.2.14",
    "@types/node": "~8.9.4",
    "@types/jasmine": "~3.3.8",
    "@types/jasminewd2": "~2.0.3",
    "codelyzer": "^5.0.0",
    "jasmine-core": "~3.4.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~4.1.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~2.0.1",
    "karma-jasmine": "~2.0.1",
    "karma-jasmine-html-reporter": "^1.4.0",
    "protractor": "~5.4.0",
    "ts-node": "~7.0.0",
    "tslint": "~5.15.0",
    "typescript": "~3.5.3"
  }
}

Additional information:

> Angular CLI: 8.3.25
> Node: 12.16.1
> OS: win32 x64
> Angular: 8.2.14
hypery2k commented 4 years ago

cannot reproduce the error, please post a sample project