noble icon indicating copy to clipboard operation
noble copied to clipboard

Doesn't work in the browser

Open maelp opened this issue 1 year ago • 5 comments

When trying to import a lib which itself uses noble from a Vue app, I get this error

CleanShot 2024-10-18 at 01 10 20@2x

maelp avatar Oct 17 '24 23:10 maelp

it seems one of the dependencies of noble is looking for the process variable which doesn't exist when using Vite (we need import.meta.env)

maelp avatar Oct 17 '24 23:10 maelp

This package is not for browser environment . Should only be used in Node.js. "Process" is one of core module of NODE.JS

BFjacky avatar Nov 14 '24 08:11 BFjacky

Hmmmm it's too bad that it implements a wrapper for Webbluetooth but wouldn't be available in browsers no?

maelp avatar Nov 14 '24 08:11 maelp

If using vite you could just use meta rather than process to access ENV variable both in Node and browser

maelp avatar Nov 14 '24 08:11 maelp

This package is not for browser environment . Should only be used in Node.js. "Process" is one of core module of NODE.JS

It can be. Was browserifyable a few years ago at least:

https://github.com/noble/noble/pull/238

monteslu avatar Feb 05 '25 17:02 monteslu