Importing node_module on Dashboard Page

Hello,
I’m trying to create a dashboard page that syncs files with my company’s Dropbox. I’ve installed the Dropbox module and set up the basic functionality of the page. It works well when I view it in Preview mode. However, I just tried to publish the site, and none of the page code runs. After some playing around, it seems that there’s one line of code that prevents the rest of the script from running:

import dropbox from 'dropbox';

If I comment that line out, everything else (not related to Dropbox) functions well. If I include only that line and some basic test code, it still hangs:

import dropbox from 'dropbox';

// This won't ever run
$w.onReady(() => {
    $w('#image1').hide();
})

Why would this cause the code to cease running on a published dashboard page but not Preview mode? Is this a bug? Is there some other way that it needs to be programmed? Any feedback would be really appreciated.

https://support.wix.com/en/article/corvid-managing-external-code-libraries-with-the-package-manager
https://www.wix.com/corvid/forum/corvid-tips-and-updates/you-can-now-use-npm-modules-in-your-code

You need to use that import on your backend file code.
Then on your page code, you need to import the function from your backend file.

Thanks. I was able to get it to list files from the backend using async functions and awaits. The problem is now passing a file object to the backend (it gets cast to a normal object for some reason when I do so, and the content of the uploaded files is always just a string, “[object: Object]”). Since that’s a separate issue and requires more info, I’ll post a new thread about it.