Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Loading momentum.js via parcel returns empty object #11

Closed
nileshinkane opened this issue May 25, 2020 · 1 comment
Closed

Loading momentum.js via parcel returns empty object #11

nileshinkane opened this issue May 25, 2020 · 1 comment

Comments

@nileshinkane
Copy link

nileshinkane commented May 25, 2020

Here is what I did

import { Tween } from "gsap/gsap-core";
import momentum from "momentum.js/dist/momentum.min.js";

const animateHeroImages = () => {
   // Some random function
};

const draggable = () => {
  const cloud = document.querySelector(".cloud");
  const container = document.querySelector(".hero-container");
  console.log(cloud, container);

  let drag = new momentum.Draggable(cloud, {
    container: container,
    friction: 0.055,
    containerBounds: true,
    resizeUpdate: true,
    autoAnchor: true,
  });
  console.log(momentum);
};

export { animateHeroImages, draggable };

This gives me console error -

indexScripts.js:42 Uncaught (in promise) TypeError: _momentumMin.default.Draggable is not a constructor.

Also when I console log the imported momentum from the dist folder, it returns an empty object.

I am using -

  1. Chrome - 83
  2. parcel-bundler
@davideperozzi
Copy link
Owner

Hi @nileshinkane

Try updating to version 1.2.2. With that version you are able to use normal imports:

import { Draggable } from "momentum.js";

Parcel should handle the rest :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants