knx-datapoints icon indicating copy to clipboard operation
knx-datapoints copied to clipboard

Bugfix to deploy as bundle for browser applications

Open mymazl opened this issue 5 years ago • 1 comments

I was trying to create a bundle for this repository. First with Browserify I was getting too much errors, because the project structure seemed not to be valid to Browserify. Next I tried Webpack and was running into an TypeError while allocating a buffer to encode a boolean value.

Uncaught TypeError: Cannot use 'in' operator to search for 'length' in true at fromObject (index.js:299) at from (index.js:137) at new Buffer (index.js:113) at Uint8Array.fill (index.js:1633) at alloc (index.js:184) at Function.Buffer.alloc (index.js:194) at Object.encode (dpt001.js:29) at Object.encode (dpt.js:40) at component (index.js:12) at Module.eval (index.js:24)

This problem occurred in every browser with my web pack bundle.

After changing this two lines of code, I was able to run the library in my Web App.

All your tests are still doing well, so I think, that should be a no-brainer :)

Thank you so much for that great library!!

  • Marcel -

mymazl avatar Apr 14 '20 13:04 mymazl

If you want me to, I can also add the changes in packages.config with adding npm run script to generate that web pack bundle.

mymazl avatar Apr 14 '20 13:04 mymazl