eclipse-thingweb / eclipse-thingweb/node-wot

Webpack and node-wot Browser bundle

Open
#324 4 comments 0 reactions 0 assignees View on GitHub
browser-bundle bug good first issue
Dominant language
TypeScript
Stars
192
Forks
100
Avg merge
3d 2h
Merged PRs (30d)
6

Description

I am trying to use node-wot as a client in a webpack application. The library can be only loaded using a dynamic import (i.e. `const wot = await import("@node-wot/browser-bundle")`) and it seems that it misses some node built-ins. In fact, subscribing to an event throws the following error:
```
app.js:175 Uncaught (in promise) TypeError: _$punycode_37.toASCII is not a function
at Url../node_modules/@node-wot/browser-bundle/dist/wot-bundle.min.js.Url.parse (app.js:175)
at Object.urlParse [as parse] (app.js:175)
at Function.e.extractScheme (app.js:175)
at app.js:175
at Array.map ()
at Object.t.getClientFor (app.js:175)
at app.js:175
at new Promise ()
at Object.t.subscribeEvent (app.js:175)
at app.js:10052
```
AFIK The `punycode` library should be a builtin of node.js, but here it misses the `toASCII` function. However, if you require `node-wot` as an html script it works.


Does somebody have more experience with webpack and node-wot?

p.s. I also want to add that for the browser bundle we don't have a valid typescript type definition file.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.