lgleim / mxgraph-typings

Typescript Type Definitions / Typings for https://github.com/jgraph/mxgraph
MIT License
25 stars 28 forks source link

Module not found: Error: Can't resolve 'mxgraph' #2

Closed dna495 closed 6 years ago

dna495 commented 6 years ago

Hi Lars,

I'm trying to implement your example

const mx = require('mxgraph')({ mxImageBasePath: 'mxgraph/images', mxBasePath: 'mxgraph' }); and am getting "Module not found: Error: Can't resolve 'mxgraph'".

I'm building with Angular CLI / Webpack. The following is my tsconfig.json { "compileOnSave": false, "compilerOptions": { "outDir": "./dist/out-tsc", "baseUrl": "src", "sourceMap": true, "declaration": false, "moduleResolution": "node", "emitDecoratorMetadata": true, "experimentalDecorators": true, "target": "es2016", "lib": [ "es6", "dom" ], "traceResolution": true, }

Any suggestions?

Thanks Dave

ViksYelapale commented 6 years ago

Hi Lars, dna495,

I have similar issue. I have installed using this command: npm install lgleim/mxgraph-typings --save

And i have imported it in my module like: import {mxgraph} from 'mxgraph';

Till then i am not getting any error while ng serve.

But when i add this:

const mx = require('mxgraph')({ mxImageBasePath: 'mxgraph/images', mxBasePath: 'mxgraph' });

OR I try to use it without const:

const graph: mxgraph.mxGraph = mxgraph.mxGraph(someDOMContainer);

And i run ng serve, I get error as follows:

Module not found: Error: Can't resolve 'mxgraph' in 'path to my file where I have imported and used mxgraph'

Do you have any idea about it?

Thanks in advance!!

lgleim commented 6 years ago

This is actually an issue with the upstream mxgraph package not being properly published to npm rather then an issue of the typings. Please feel free to push the corresponding (incorrectly closed) issue: https://github.com/jgraph/mxgraph/issues/169

ViksYelapale commented 6 years ago

Thanks for quick response !! Will push to the issue jgraph/mxgraph#169.