I am using Syncfusion, diagrams, grids and other components in my app. Everything was working fine when I was importing the Syncfusion Javascript files in the main.ts
import 'syncfusion-javascript/Scripts/ej/web/ej.web.all.min';
and then
export function configure(aurelia: Aurelia) {
aurelia.use
.standardConfiguration()
.feature(PLATFORM.moduleName('resources/index'))
.plugin(PLATFORM.moduleName('aurelia-api'), config => {
// Register hosts
config
.registerEndpoint('api', urlConfig.apiRoute)
.setDefaultEndpoint('api')
})
.plugin(PLATFORM.moduleName('aurelia-authentication'), baseConfig => {
baseConfig.configure(authConfig);
})
//config.registerEndpoint('other-api', '/otherpath', { headers: { 'Content-Type': 'x-www-form-urlencoded' } });
.plugin(PLATFORM.moduleName('aurelia-syncfusion-bridge'), plugin => plugin.ejGrid().ejDatePicker().ejDiagram().ejOverview().ejTemplate());
//Aurelia fetch client configuration with aurelia-authentication
const httpClient = aurelia.container.get(HttpClient);
const authService = aurelia.container.get(AuthService);
const accessToken = 'Bearer ' + authService.authentication.accessToken;
httpClient.configure((config: any) => {
config
.withDefaults({
headers: {
"Authorization": accessToken
}
});
});
aurelia.start().then(() => aurelia.setRoot(PLATFORM.moduleName('app')));
}
But, when building, the app.bundle size becoming very large, more than 40MB. So I decided to move the Syncfusion script to CDN, which will reduce the bundle size to 7MB.
So I removed the import from main.js and added the below CDN in the _Layout.cshtml file
Since then I am having issues while page load and getting below error in console.
"aurelia-task-queue.js?26b6:44 Uncaught TypeError: Cannot read property 'helpers' of undefined"
The pages with date picker work fine if we reload. The grid displays pagination correctly, but data not getting rendered.
Please help me find what the issue is and how to use the CDN correctly so that I can reduce the app bundle size.