Closed ellanan closed 2 years ago
For anyone else running into this and using webpack, a workaround is to alias tslib
to tslib: '/node_modules/tslib/tslib.es6.js'
so it uses the version at your project root rather than the one in react-remove-scroll's node_modules
@ellanan could I trouble you to explain how you ran into this error? I run into this same error compiling from a rails + webpacker app, yet I do not have this error in a barebones create-react-app I spun up for testing.
Edit: the CRA is running node v16, the rails app is running node v12 if that matters
It's all depend on the version of tslib you already have.
This was an old project, I ran into it while upgrading its chakra version from 0.8 to 2.0
One of the other dependencies had already triggered tslib 2.0.3 to be installed and that happened to satisfy this library's requirement of "tslib": "^2.0.0"
The current SideEffect.js gets transpiled to import
import { __spreadArray } from "tslib";
https://unpkg.com/react-remove-scroll@2.5.3/dist/es2015/SideEffect.js__spreadArray
was not added into tslib until 2.1.0The current dependency on
"tslib": "^2.0.0",
is resulting in fresh installs installing tslib2.0.3
and erroring withAttempted import error: '__spreadArray' is not exported from 'tslib'