smooth-dnd
smooth-dnd copied to clipboard
Uncaught TypeError: Illegal invocation
Posting this issue here as well as it seems to be related deeper to smooth-dnd rather than react-smooth-dnd.
We're getting a Uncaught TypeError: Illegal invocation
error when using react-smooth-dnd with @loadable/component
.
Specifically, we're trying to import a component that uses react-smooth-dnd dynamically. As the page loads, the error is thrown. The full stack trace is as below:
loadable.esm.js:269 Uncaught TypeError: Illegal invocation
at Node.get (VM217 8.js:97747)
at VM217 8.js:97747
at VM217 8.js:97747
at Object../node_modules/smooth-dnd/dist/index.js (VM217 8.js:97747)
at __webpack_require__ (VM210 app.js:64)
at VM217 8.js:89812
at Object../node_modules/react-smooth-dnd/dist/index.js (VM217 8.js:89812)
at __webpack_require__ (VM210 app.js:64)
at Module../src/components/Sunspot/index.js (VM218 10.js:13301)
at __webpack_require__ (VM210 app.js:64)
Googling on the issue seems to point towards a loss of context or an undefined global variable after webpack builds.
Has anyone faced similar issues? Any help would be much appreciated. We burned a weekend trying to solve this single issue.
Update: Wanted to add a note that the application works when running via webpack-dev-server directly, but throws the error above after webpack builds it.
I have the same problem using Vue package.
TypeError: Illegal invocation
at Node.get (index.js:1)
at index.js:1
at index.js:1
at Object.c878 (index.js:1)
at c (bootstrap:88)
at Object.3f7d (vue-smooth-dnd.esm.js:1)
at c (bootstrap:88)
at Module.6511 (home.vue?1676:4)
at c (bootstrap:88)
at .*\.vue$ namespace object:22
And problem only occurs in production stage. Using development server works fine.
@ahmadsholehin I have the same issue, but only when running the whole test suite on linux. Running single tests and the whole suite works fine on macOS. Did you find a solution?
Update: This can be fixed with jest setupFiles, as described here https://github.com/kutlugsahin/smooth-dnd/issues/36