Hi all :wave:! We’re moving to Extensibility API t...
# suitecommerce
m
Hi all 👋! We’re moving to Extensibility API to customize the base
JavaScript
and we want to use modules from
Commons
(SCA 2019.2.0 version) from base
JavaScript
folder in
Extension Developer Tools
but couldn’t find a way to use it. For example
ModalView
from
GlobalViews
Can anyone tell us how we can use those modules?
s
Just add them as dependencies to your module. As for modals specifically, you don't need to add it as a dependency: you can just tell it to render your chosen view in a modal by using the layout's
showInModal()
method.
👍 1
e
@Steve Goldberg I am curious if that is the only thing we need to do, I was trying to use backbone.custom in a extension, I included it as a dependency but in the console it complained as backbone.custom is needed by 'my module file'. It was local I never deployed, I am not sure if that is necessary to make it work the first time.
s
I've not heard of Backbone.Custom before
Some module codes do not 'export' as modules and therefore cannot be / do not need be 'required' as a dependency to be used. This might be because they simply extend existing modules/classes, create global namespaces, are shimmed into other modules, etc
For example, we suggest you include
jQuery
in your dependencies whenever you use it but jQuery is a soft dependency of Backbone, which means that as long as we use it as our library of choice to power Backbone, you don't technically need to require it. The same is true of Underscore, which is actually a hard dependency of Backbone.
e
Thanks for the details! I think it might be one of the case you just mentioned.
import Backbone = require('../../../Commons/Utilities/JavaScript/backbone.custom');
The backbon.custom is used in all the front-end models on 2019.2
so when I was creating my model in my extension I tried to require it but I got the error I mentioned above, so I am using just the Backbone module