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