DHTMLX Gantt + Export in Angular 12

Hello,
We are using DHTMLX Gantt 7.1.6 in an Angular 12.1.1 project.
We followed this example:

https://files.dhtmlx.com/30d/97f9408ca0d5b84902b03589b45ecd04/angular9+export.zip?_ga=2.162033784.579483622.1646648076-822745308.1646401376

Unfortunately, we are getting this error:

Error: Module not found: Error: Can't resolve 'http'.

BREAKING CHANGE: webpack < 5 used to include polyfills for node.js core modules by default.
This is no longer the case. Verify if you need this module and configure a polyfill for it.

If you want to include a polyfill, you need to:
- add a fallback 'resolve.fallback: { "http": require.resolve("stream-http") }'
- install 'stream-http'
If you don't want to include a polyfill, you can use an empty module like this:
resolve.fallback: { "http": false }

How can we successfully include and use the export module in projects with Angular 12?

Hello Silvia,
It seems that the issue with the export’s api.js file occurs because of the functionality that was added to support Node.js import and export. Although, that code is not used in the browser, Angular checks it and tries to execute it.
In the future, you won’t need to include that file to enable the import and export functionality. For now, you can use the modified file:
https://files.dhtmlx.com/30d/b852e57786b76abc6f21d67011cb3cd3/export_api.js

Here is the demo for Angular 12:
https://files.dhtmlx.com/30d/2be4367b5f775926c51b7e979309eefb/angular12+export.zip

1 Like