currently, in all of our models and custom ajax request, we are using loader.serviceBaseURL to get the serviceBaseUrl which we have defined in package.json would it will be possible to overwrite it like globally?
"envs": {
"nw-production": {
"serviceBaseURL": "http://localhost"
}
Like in root file: app.js and if we call import loader from ‘@loader’; and further loader.serviceBaseURL it will use the url which we define in app.js
we are currently using in our node-webkit
Why do you want to define it in the app.js rather than in the package.json? Do you need JavaScript to determine the URL? If so, rather than using loader.serviceBaseURL
I would recommend creating a new module for this sort of configuration:
config.js
export const serviceBaseURL = 'http://' + whatever;
models/todo.js
import { serviceBaseURL } from '../config';
// ... define your model and use serviceBaseURL
1 Like
Matthew thanks for your valuable response whereas I have just given an example of app.js to overwrite serviceBaseUrl. I have certain reasons to support this feature, First of all, if I have to update with some other then I have to again make changes in package.json file and rebuild my application which I don’t want and second or applications are used by different users and each of them have their dynamic service URL so we can’t use URL which we had set up in package.json
I know that we can create a new module, I had checked it yesterday but if we do then we have to update all of our files and might be there are some custom ajax files which we created, which used loader.serviceBaseUrl.
So I am looking for an efficient way to overwrite steal.js loader - serviceBaseUrl.