Possible Conflict in Backendless NPM Package and SvelteJS

Not entirely sure this is an issue with the NPM package but bringing it up just incase. I have a Svelte application that imports the Backendless NPM package to be used across the project. It is currently being deployed to Netlify. My last ‘working’ build was September 22nd. I say ‘working’ in quotes because the build is successful, just doesn’t appear to work on the client side.

Sometime between September 22 and October 4, any new deployments return this message on the client side:

I dug into the code and removed every package and was able to get it to work. As I worked through the packages, I noticed the latest version of Backendless (6.2.25) outputting this log in the console:

transforming (437) node_modules\backendless\es\messaging\helpers\delivery-options.js
'emitter' is imported by emitter?commonjs-external, but could not be resolved – treating it as an external dependency

I rolled back to version 6.2.23 and saw a similar issue but in a different file. I rolled back until 6.2.21 and was still seeing the issue. I think that SvelteJS is mad about something. Here are all the different build messages (not errors!) I got during the build.

6.2.25
transforming (437) node_modules\backendless\es\messaging\helpers\delivery-options.js
'emitter' is imported by emitter?commonjs-external, but could not be resolved – treating it as an external dependency

6.2.23
transforming (391) node_modules\backendless\es\data\geo\geo-constructor.js
'emitter' is imported by emitter?commonjs-external, but could not be resolved – treating it as an external dependency

6.2.22
transforming (439) node_modules\backendless\es\messaging\helpers\body-parts.js
'emitter' is imported by emitter?commonjs-external, but could not be resolved – treating it as an external dependency

6.2.21
transforming (409) node_modules\backendless\es\data\rt-handlers.js
'emitter' is imported by emitter?commonjs-external, but could not be resolved – treating it as an external dependency

This works when I run Svelte locally but not when I build it for production. The client side error only occurs during the build process. If I remove Backendless, the error goes away.

This is the only article I could find that references something similar to the error I’m seeing:
http://dplatz.de/blog/2019/es6-bare-imports.html

Hello @Zach_Voss1

Are you have at least one successful build? (on client-side too)
If yes, what version of SDK and Svelte you used?

Also, it might be related not to our SDK or Svelte. I think the problem in bundler, if I clearly understand - Rollup in your case.

Here is information that makes clear some aspects of the question(link). I understand it’s about Vue and Webpack, but it’s still related to the question.

Regards, Dima.

Thank you for sharing that article. I went through 300+ import statements and verified that everything was being imported properly. I even updated all the Svelte packages as well.

I tested with the latest Backendless package at 6.2.25 and that had the emitter client side error. Then I rolled back to a version that I am using in a different project that is working, 6.2.22 and that for some reason did not work on this project. When I remove the import of Backendless, the site loads correctly on the client side.

I’m completely lost. I have no clue what could have caused this to start happening. I am afraid to touch my other projects incase this happens on them too.

So I redid the process where I removed each of the packages and discovered that this was causing the issue

"stream": "0.0.2",

in my package.json file. I removed this but now I’m having other, non-backendless issues. Thanks for your help Dima. I’ll keep troubleshooting. Leaving this note here incase you guys want to investigate any potential conflictions.