Hi guys,
I’m trying to use the latest version of backendless with webpacks, but I’m getting some errors.
I’m using the latest version, 3.0.9.
So I import in my javascript file
import Backendless from 'backendless'
Backendless.initApp(APPLICATION_ID, APPLICATION_KEY, APPLICATION_VERSION)
Warning:
WARNING in ./~/backendless/libs/backendless.js
Critical dependencies:
384:24-41 the request of a dependency is an expression
@ ./~/backendless/libs/backendless.js 384:24-41
WARNING in ./~/backendless/libs/backendless.min.js
Critical dependencies:
23:208-218 the request of a dependency is an expression
@ ./~/backendless/libs/backendless.min.js 23:208-218
And because of this, looks like webpack is not able to load the library.
Uncaught TypeError: _backendless2.default.initApp is not a function
Anybody knows how to fix it?
Thanks 
Hi Rafael,
Please pardon my ignorance… Could you please let me know what a “webpack” is?
Regards,
Mark
Did you import both backendless.js and backendless.min.js?
Hi,
Import both?
I’m importing using
import Backendless from 'backendless'
or
require('backendless')
in both cases I got an empty Object. 
Looks like doesn’t works very well with webpack.
About the warning message, I add a config to skip this, but this just fix the error message, I still receiving an empty object 
module: {
noParse: [
/backendless/,
]
}
How many .js files for Backendless do you have? There should be only one (either backendless.js or backendless.min.js)
Hi Mark,
Like I said I’m using the node package require method, so he should load the backendless.js.
Usually when I run
npm run dev
He compiles the unminified version, the min version is only when you run the production command.
I was doing some searchs, and looks like some people are having the same problem with AWS-SDK.
Tonight I wil try to take a look deep on thins, and try to make it work. 
Have you considered using bower instead?
Webpack is a totally different approach.
It’s weird don’t see the people here in forum talking about Browserify or Webpack. 
Hi Mark,
Any chance to make it work with webpack?
Hi Rafael,
We’ll get this to work. We will let you know when it is ready.
Regards,
Mark
For now, what I did and its working is:
I load the javascript in my html
<script src="http://api.backendless.com/sdk/js/latest/backendless.js"></script>
then in my main.js I initialize and export the Backendless object
export const Backendless = window.Backendless
Backendless.initApp(APPLICATION_ID, SECRET_KEY, VERSION)
so inside from my other files I can just import like this
import {Backendless} from 'scr/main'

Hi Rafael,
we have updated our JS-SDK, try to use updated version and now do not write
<script src="[url=http://api.backendless.com/sdk/js/latest/backendless.js%22%3E%3C/script%3E]http://api.backendless.com/sdk/js/latest/backendless.js"></script>[/url];
export const Backendless = window.Backendless
Just make a require and export it if you need.
const Backendless = require('backendless');
It should work fine.
Let me know if everything’s okay, please.
Regards,
Stanislav
Mark, 5 months later
can we already use backendless with webpack in a proper way?
Hi Maikel,
Sorry, we have not done any specific work with webpack.
The SDK is open source, there is absolutely nothing that would stop you (or anyone familiar with webpack for that matter) from getting it integrated: https://github.com/Backendless/JS-SDK
Can you help?
Regards,
Mark
Hi Maikel,
you can use our SDK like any other lib. I don’t really understand what you mean saying “proper way”, but usually I import it like ES6 module
import Backendless from 'backendless'
Please try it and say if it what you need and if there are any problems with such importing.
Regards,
Stanislaw