Dependency on ‘hammerjs’. CommonJS or AMD dependencies can cause optimization bailouts

I am working on an angular application with Angular CLI 11.0.2 and I am using hammerJS in my application to handle the swipe events.

When I compile the application, I have the following warning message:

Warning: F:ProgramsGoodRiddlesgitangularsrcappconfighammerjs.config.ts depends on 'hammerjs'. CommonJS or AMD dependencies can cause optimization bailouts.
For more info see:

From what I could understand here, I should replace hammerJS by an ECMA version of the library.

My question is:
Is there a proper way (without simply hiding the message) to fix it? Do I need to use another library instead?

If it can help, this is how I use it:

import { Injectable } from '@angular/core';
import { HammerGestureConfig } from "@angular/platform-browser";
import * as hammer from "hammerjs";

export class HammerConfig extends HammerGestureConfig {
    overrides = <any>{
        swipe: { direction: hammer.DIRECTION_HORIZONTAL },
        pinch: { enable: false },
        rotate: { enable: false }

Source: Angular Questions