mirror of
https://github.com/meshcore-dev/meshcore.js.git
synced 2026-04-20 22:13:49 +00:00
Add a browser-only export for Web clients
This package has a single export that includes both NodeJS and browser modules. When a web project imports this library, the build generates a bunch of warnings, like this in vite: [plugin vite:resolve] Module net has been externalized for browser compatibility... [plugin vite:resolve] Module stream has been externalized for browser compatibility... ... We can clean this up by creating a special browser-only export. Bundlers like Vite and Webpack know to choose the 'browser' export in projects that are web-only (not NodeJS). This change adds a 'browser' export and updates the documentation to use browser-only examples.
This commit is contained in:
parent
f6fea65063
commit
486a075b8e
5 changed files with 70 additions and 7 deletions
12
index.html
12
index.html
|
|
@ -195,10 +195,12 @@
|
|||
</div>
|
||||
|
||||
<script type="module">
|
||||
import Constants from "./src/constants.js";
|
||||
import WebSerialConnection from "./src/connection/web_serial_connection.js";
|
||||
import WebBleConnection from "./src/connection/web_ble_connection.js";
|
||||
import BufferUtils from "./src/buffer_utils.js";
|
||||
import {
|
||||
Constants,
|
||||
WebSerialConnection,
|
||||
WebBleConnection,
|
||||
BufferUtils,
|
||||
} from "./src/browser.js";
|
||||
Vue.createApp({
|
||||
data() {
|
||||
return {
|
||||
|
|
@ -696,4 +698,4 @@
|
|||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
</html>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue