Importing primus.js client code #2631
Unanswered
PlkMarudny
asked this question in
Troubleshooting
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I cannot import Primus client. The client code is generated as UMD module I believe, but Snowpack cannot import it - Rollup however, can.
Using Rollup, it works like that:
import Primus from "./primus-client"; const p = new Primus;
client code is in the primus-client.js file.
This does not work with Snowpack; the error is:
SyntaxError: The requested module './primus-client.js' does not provide an export named 'default'
Named import does not work either:
SyntaxError: The requested module './primus-client.js' does not provide an export named 'Primus'
How to deal with such a case? Primus simply creates window.Primus object, but this is somehow striped by Snowpack.
Beta Was this translation helpful? Give feedback.
All reactions