buttplugio / buttplug-rs-ffi

FFI from buttplug-rs to Java and other languages
Other
89 stars 22 forks source link

Runtime error regarding undefined imports on Buttplug versions 1.0.15 - 1.0.17 when using Webpack 5 #95

Open amydevs opened 1 year ago

amydevs commented 1 year ago

Describe the bug All the imports from "buttplug" are undefined when loading the library with Webpack 5 without transpiling dependencies. An example of the error message shown: TypeError: buttplug__WEBPACK_IMPORTED_MODULE_4__.buttplugInit is not a function Upon console.log'ing any import from "buttplug", it is undefined. This behavior has been exhibited in freshly-created Vue 3 / and Next.js projects.

Expected behavior Importing from "buttplug" should be defined.

Actual behavior Error: TypeError: buttplug__WEBPACK_IMPORTED_MODULE_4__.buttplugInit is not a function None of the imports are defined.

Additional context This issue happens from "buttplug" version 1.0.15 onwards. The same behaviour happens also when importing through these methods:

const { buttplugInit } = await import('buttplug');
import * as Buttplug from "buttplug";

An example of this happening can be seen here: https://github.com/jy1263/buzzy-vue/tree/latest-buttplug It's interesting that window.Buttplug is defined with everything in it though.