How to fix ERROR TypeError: Class constructor HammerGestureConfig cannot be invoked without 'new'
you can go to tsconfig.json file and change your target to es5 (ECMAScript 5) like this :
{
"compileOnSave": false,
"compilerOptions": {
"baseUrl": "./",
"outDir": "./dist/out-tsc",
"sourceMap": true,
"declaration": false,
"module": "esnext",
"moduleResolution": "node",
"emitDecoratorMetadata": true,
"experimentalDecorators": true,
"importHelpers": true,
"target": "es5",
"typeRoots": ["node_modules/@types"],
"lib": ["es2018", "dom"]
}
}
credit to : https://github.com/lukasz-galka/ngx-gallery/issues/242#issuecomment-483223817
or recommended way: you can use this way if you don't want change target :
going to node_modules => ngx-gallery => bundles => ngx-gallery.umd.js
change this :
var CustomHammerConfig = /** @class */ (function (_super) {
__extends(CustomHammerConfig, _super);
function CustomHammerConfig() {
var _this = _super !== null && _super.apply(this, arguments) || this;
_this.overrides = ({
'pinch': { enable: false },
'rotate': { enable: false }
});
return _this;
}
return CustomHammerConfig;
}(platformBrowser.HammerGestureConfig));
to
class CustomHammerConfig extends platformBrowser.HammerGestureConfig {
constructor() {
super(...arguments);
this.overrides = ({
'pinch': { enable: false },
'rotate': { enable: false }
});
}
}
https://github.com/lukasz-galka/ngx-gallery/issues/242#issuecomment-502917803
There is a better approach to fixing this.
Modify the providers in your app.module.ts with
export class CustomHammerConfig extends HammerGestureConfig {
overrides = {
pinch: { enable: false },
rotate: { enable: false }
};
}
and add to the Providers
providers: [
{
provide: HAMMER_GESTURE_CONFIG, useClass: CustomHammerConfig
}
]