Skip to content

Hammer import crashes Rollup build (ESM version) #917

Open
@marisst

Description

@marisst

I integrate the Zoom plugin in my code like this:

import zoomPlugin from 'chartjs-plugin-zoom';

Then I run a Rollup build:

 npm run build

The build crashes with the following error:

crash

In order to fix the build, I go manually edit chartjs-plugin-zoom.esm.js and replace line 7:

import Hammer from 'hammerjs';

with

import 'hammerjs';

I could not find an official guide how to integrate Hammer ESM package, but this Stackoverflow answer seems to have a lot of votes and here I found the solution.

If would be great to fix this in the source code, so this fix doesn't have to be done manually after every install or update of the npm package.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions