Skip to content

Cannot find module 'tween' when requiring scroll-to server side #9

@pixelwhip

Description

@pixelwhip

I'm using scroll-to-element in a React app that pre-renders on the server. When requiring scroll-to-element, which is dependent on scroll-to, I get Error: Cannot find module 'tween'.

I believe this is because scroll-to requires component-tween via var Tween = require('tween'); which works in browser environments because of the following in package.json.

  "browser": {
    "raf": "component-raf",
    "tween": "component-tween"
  },

everything works fine in the client, but the application errors out when running on the server because node doesn't know what tween is.

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