cedricdelpoux / cedricdelpoux/react-responsive-masonry

TypeError: Cannot set property ResponsiveMasonry of #<Object> which has only a getter in npm package

Open
#156 1 comment 2 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
455
Forks
47
PR merge metrics
No merged PRs in 30d

Description

In lib folder of npm package,
This line in index.js:
Object.defineProperty(exports, "ResponsiveMasonry", {
enumerable: true,
get: function get() {
return _ResponsiveMasonry["default"];
}
});

creates an accessor property on exports for ResponsiveMasonry. That means it's defined with a getter only, not a writable value.
Then later, this line appears:
exports.ResponsiveMasonry = _ResponsiveMasonry["default"];

This attempts to assign to exports.ResponsiveMasonry, which throws a TypeError in strict mode because the property is not writable.

The fix is pretty easy. ResponsiveMasonry does not need to expose twice, just remove one of the expose. I understand this code was generated by the compiler. Could you please take a look please?

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.