'capacitorExports is not defined' error during bundling
See original GitHub issueFirst of all, thank you for your work on the plugin @pwespi, I believe it will help us greatly when we make it work 😃
Here is the issue:
Describe the bug
Our project’s web assets (webpack) build is failing if the following import { BleClient } from '@capacitor-community/bluetooth-le';
defined somewhere in the code.
The error is the following:
ReferenceError: capacitorExports is not defined at Object.<anonymous> (/projectDir/node_modules/@capacitor-community/bluetooth-le/dist/plugin.js:403:7)
The contents of the plugin.js file at line 403 (with some additional lines above, for context):
...
exports.BleClient = BleClient;
exports.BluetoothLe = BluetoothLe;
exports.BluetoothLeWeb = BluetoothLeWeb;
exports.dataViewToHexString = dataViewToHexString;
exports.dataViewToNumbers = dataViewToNumbers;
exports.dataViewToText = dataViewToText;
exports.hexStringToDataView = hexStringToDataView;
exports.mapToObject = mapToObject;
exports.numberToUUID = numberToUUID;
exports.numbersToDataView = numbersToDataView;
exports.textToDataView = textToDataView;
exports.webUUIDToString = webUUIDToString;
Object.defineProperty(exports, '__esModule', { value: true });
return exports;
}({}, capacitorExports)); // <-- line 403 from the error
We are using the NextJS’s next build
command to run build, but I guess it doesn’t matter which bundler is used.
To Reproduce Steps to reproduce the behavior:
- install bluetooth-le capacitor plugin and import it somewhere.
- Run the build to bundle your app.
Expected behavior The build is passing without errors from the plugin.
Issue Analytics
- State:
- Created 3 years ago
- Comments:7 (4 by maintainers)
Top GitHub Comments
Closed in #14 and released as 0.1.1.
(no need to change the import, just use
import { BleClient } from "@capacitor-community/bluetooth-le";
)Thanks a lot, everything’s working smoothly now! 🎉