Cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Wildcards not working as imports in SDK 4.3

Hello,

I am having some issues with the SDK. None of the examples work as intended (including the sample apps) when I try to display text (or do a myriad of other things). 

 

I seem to have narrowed it down to what seems to be a bug in the 4.3 SDK.

I have narrowed it down to the fact that wildcard imports fail every time. Here is an example. 

 

Say I want to have an app that displays some test. I create an entry in index.js labeled "someText"

Then, in my index.js file, I write this...

 

import * as document from "document";

let someText = document.getElementById("someText");
someText.text = "Hey world, what's up?";

 

I notice two things. 

1) The asterisk is not colored as a wild card

2) line 3 fails with the following error...

 

Unhandled exception: TypeError: Expected a function.
? at app/index.js:3,5

 

Yet, if I change it to 

 

import document from "document";

let someText = document.getElementById("someText");
someText.text = "Hey world, what's up?";

 

It works as expected. This would not be a problem if all I was needing to do was write text, but it seems to affect every wildcard import, and I am trying to use filesystem at the moment, so I will need access to read and write (and do more complex operations with other libraries like JSON or CBOR after that).

 

Does anyone have any advice as to how to proceed?

Best Answer
6 REPLIES 6

As you have found the other link indicating the same error, it should be noted here that, there also seem to be other consequences to changing the import for 4.3.

 

There also seems to be a code generation issue in the 4.3 build as well. Such that the generated code no longer fits in the memory of pre Versa 2 watches if the project is large.

 

Rebuilding projects from existing source can now fail to load as a consequence, where it loaded and ran fine with a 4.2 build.

 

So there might be 2 errors with SDK 4.3.

 

If you don't change the import it won't run and if you do it won't fit.

 

Impasse!

Author | ch, passion for improvement.

Best Answer

It looks like the 4.3 version of the SDK did not correctly pin the old version of Rollup. We'll be addressing this in an update very soon.

Best Answer

I am seeing the same issue too.

Best Answer
0 Votes

Thank you for this. Messaging seems broken as well. I would revert to 4.2, but I am using the web portal, so the 4.3 update is forced. Here is the error.

 

import messaging from "messaging";
messaging.peerSocket.onopen = () => {
  console.log("Companion Socket Open");
  restoreSettings();
};

 

 

This produces the following error...

 

[11:19:41 AM]TypeError: Cannot read property 'peerSocket' of undefined
? at companion/index.js:5,1

 

 

Edit: The wildcard for messaging worked as expected on both the app and the companion.

Best Answer
0 Votes

Hi JonFitbit,

now it's end of september and I'm facing this issue as well. When is a bugfix/update expected?

Best Answer

I think the fix has been rolled out. If you're using CLI, you may need to update your SDK line and 

npm i

or equivalent.

Peter McLennan
Gondwana Software
Best Answer