Skip to content

"prop-types" is listed as devDependency but is always imported, resulting in runtime errors #62

@Yuval-Peled

Description

@Yuval-Peled

This library's source code includes this line:

import PropTypes from "prop-types";

https://github.com/felippenardi/lottie-react-web/blob/bcebeaac478094776ca7396085ada4055ec95bad/src/index.js#LL2C32-L3C1

But "prop-types" is only listed as devDepenecy, which is not installed by default (we happen to use pnpm).

This causes a runtime error in the browser:
TypeError: Failed to resolve module specifier "prop-types". Relative references must start with either "/", "./", or "../".

The solution would be to either make the import conditional or to move propTypes to the production dependencies list (which will increase the size of this package even futher).

I'm happy to open a PR but this repository seems to be stale (3 years since last update). Will gladly submit a fix if the package maintainer says that it will be published. Otherwise, I'm opening this issue for posterity, in case other people encounter the same problem

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions