when I use ng serve to compile while development Flatpickr is working fine but when compile the whole application to deploy it on the server it gives the following error in the console
ReferenceError: Cannot access 'e' before initialization
at _ (main.84c9c5060af8f99f5713.bundle.js:formatted:95600)
at O (main.84c9c5060af8f99f5713.bundle.js:formatted:95625)
at w (main.84c9c5060af8f99f5713.bundle.js:formatted:95652)
at main.84c9c5060af8f99f5713.bundle.js:formatted:96326
at main.84c9c5060af8f99f5713.bundle.js:formatted:96441
at nC (main.84c9c5060af8f99f5713.bundle.js:formatted:96513)
at oC (main.84c9c5060af8f99f5713.bundle.js:formatted:96526)
at iC (main.84c9c5060af8f99f5713.bundle.js:formatted:96543)
at t.ngAfterViewInit (main.84c9c5060af8f99f5713.bundle.js:formatted:96580)
at Er (main.84c9c5060af8f99f5713.bundle.js:formatted:37872)
code I used to initialize Flatpickr is as below:-
this.picker = flatpickr(this.flatpickrEl.nativeElement, {
onChange: this.onDateChanged.bind(this),
wrap: true,
enableTime: true,
dateFormat: "Y-m-d H:i"
});
and tsconfig.json config is:-
"compilerOptions": {
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"moduleResolution": "node",
"emitDecoratorMetadata": false,
"experimentalDecorators": true,
"target": "es5",
"typeRoots": [
"node_modules/@types"
],
"lib": [
"es2017",
"dom"
]
}
