Skip to content
This repository has been archived by the owner on Dec 16, 2020. It is now read-only.

Not Working when Doing a ng build --prod #10

Closed
FredBesterwitch opened this issue Apr 29, 2020 · 9 comments
Closed

Not Working when Doing a ng build --prod #10

FredBesterwitch opened this issue Apr 29, 2020 · 9 comments

Comments

@FredBesterwitch
Copy link

Hi
Thanks for create these types for mxgraph, much appreciated. You have done a good job..

It works perfectly in ng serve in dev, but when we deploy the buuild that was generated by ng build --prod, it does not work, it says mxGraphModel does not exist

any help would be appreciated..

Thank You

@hungtcs
Copy link
Owner

hungtcs commented Apr 29, 2020

Hi @FredBesterwitch!,
Do you install via npm install --save-dev mxgraph-type-definitions? npm package is not perfect at present, please use git submodule, you can fork this project first, then add as a submodule in your project, I am currently using this method, working on Angular

git submodule add https://github.com/hungtcs/mxgraph-type-definitions.git src/types/mxgraph-type-definitions

If you find some types missing, you can modify your submodule and push to your fork, and then make a pull request.

@FredBesterwitch
Copy link
Author

Thanks for your quick response, i did using npm
I will try using as a sub module
Just put it in a folder under the app and use the import?

@hungtcs
Copy link
Owner

hungtcs commented Apr 29, 2020

@FredBesterwitch
mxGraph is not support es module, you can't import it.Here is a simple example https://github.com/hungtcs/angular-with-mxgraph

@FredBesterwitch
Copy link
Author

Thank You , much appreciated

@hungtcs
Copy link
Owner

hungtcs commented Apr 29, 2020

very glad if this helped.

@hungtcs hungtcs closed this as completed Apr 29, 2020
@FredBesterwitch
Copy link
Author

Can't run the sample you sent, is there something i'm missing? Thanks

ERROR in src/app/app.component.ts:9:18 - error TS2304: Cannot find name 'mxGraph'.

9 private graph: mxGraph;
~~~~~~~
src/app/app.component.ts:15:22 - error TS2304: Cannot find name 'mxGraph'.

15 this.graph = new mxGraph(this.container.nativeElement);

@hungtcs
Copy link
Owner

hungtcs commented Apr 29, 2020

@FredBesterwitch please check the src/types/mxgraph-type-definitions folder, is it empty?
clone with --recursive or exec git submodule init && git submodule update

@tbouffard
Copy link
Contributor

Hello guys
just in case, I would like to let you know that some wrapper exist around mxGraph to adress integration issues

According to asual/mxgraph-factory#9 (comment)

The main goal of this project was to provide the required Webpack configuration that turns mxGraph into a CommonJS compatible package. The type definitions were added just for convenience and can be easily dropped if there is a better alternative.

The above wrapper is not using the @hungtcs type definitions lib

@tbouffard
Copy link
Contributor

@FredBesterwitch @hungtcs this repo which is also using Angular with mxgraph-type-definitions (via npm deps) may be interesting for you: https://github.com/ivamax9/angular-mxgraph-demo

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants