You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I would like to import OSC from a Web Component in a web app (that, in browser), using the ES module import syntax:
import{OSC}from"osc";constosc=newOSC();osc.open({ host, port });
You would assume I have added the module as dependency of my package.json and did run npm install to retrieve the osc-js package from the NPM registry:
…
"dependencies": {
"osc-js": "^2.0.2",
…
},
The build of OSC version 2.0.2 currently does not support module imports. Its build uses a version
of the UMD wrapper, which contains a common bug, the incorrect detection of browser global in strict mode implied by module imports (see umdjs/umd#125).
I am unfamiliar with the build you're using, but it seems to me, it would a matter of updating the UMD wrapper you're using to the latest version – as the above mentioned UMD issue was fixed and merged on 13.10.2017.
The text was updated successfully, but these errors were encountered:
Add a <script src="../node_modules/osc-js/lib/osc.min.js"></script> element in the HTML page that bootstraps the web app (demo);
Reference OSC in global scope with the self keyword:
constwebsocketPlugin=newself.OSC.WebsocketClientPlugin();constosc=newself.OSC({plugin: websocketPlugin});osc.open({ host, port });
However, it would be nice if it could simply be imported by the web component itself, so users won't need to worry about adding (add forgetting to add!) one other <script src="…"> to every page using the web component.
Hi @olange, I think maybe the issue you filed is for a different library? Unfortunately, someone else decided to create a different library with the confusingly similar name osc-js, which, based on the same code you've provided, sounds like the library you're using.
Hi @colinbdclark, you're right, I apologize. I indeed got confused and the issue I reported was intended for @adzialocha/osc-js library. I will close this issue and report there.
I would like to import OSC from a Web Component in a web app (that, in browser), using the ES module import syntax:
You would assume I have added the module as dependency of my
package.json
and did runnpm install
to retrieve theosc-js
package from the NPM registry:The build of OSC version 2.0.2 currently does not support module imports. Its build uses a version
of the UMD wrapper, which contains a common bug, the incorrect detection of browser global in strict mode implied by module imports (see umdjs/umd#125).
I am unfamiliar with the build you're using, but it seems to me, it would a matter of updating the UMD wrapper you're using to the latest version – as the above mentioned UMD issue was fixed and merged on 13.10.2017.
The text was updated successfully, but these errors were encountered: