Hello everyone :wave:! I’m migrating to 2019.2 fro...
# suitecommerce
m
Hello everyone 👋! I’m migrating to 2019.2 from 2018.2 and we’ve override the base SuiteCommerce JavaScript files using
Copy code
ns.package.json
In the latest version all the SuiteCommerce files are in
Copy code
.ts
format and all our files are in
Copy code
.js
format. So what will be the best way to override “.ts” files? Can we override the file with this snippet?
Copy code
"overrides": {
    "../Advanced/Home/JavaScript/Home.View.ts": "JavaScript/Home.View.js",
    "../Advanced/Home/Configuration/Home.json": "Configuration/Home.json"
}
s
I don't think that is a supported use case. Overriding JavaScript files is not considered good practice in almost all scenarios, but it may work if you override the outputted JS file with your override. You may be able to create a new TS file and put your override JS in that and then tell it to override the corresponding TS file with your TS file, but this is starting to get very yucky.
m
So what will the best practice to override SCA files?
s
I believe I described your answer to your situation above. JS files can override JS files, TS files can probably override TS files (I've not tried). But the reason it's not good practice is because you're replacing core parts of our application with your own, which creates a lot of work for you (as demonstrated by this conversation).
JavaScript customisations should be introduced through extensions, or, failing that, by extending JavaScript, not replacing it.
m
Thank you for the clarification! Will try with extensions.
s
OK, you understand that this will be a completely different approach to customisations than you've done before, right? You can't override a JS file in an extension.
m
Yes, I understand that it will very big change so, will discuss with team and see what will work the best for us.
👍🏻 1
Hi @Steve Goldberg how can override the entire module using Extensibility API? I can create the view, I can add the ChildView, I can replace the ChildView, I can create the custom module, but how can I override the entire module?
s
This is not something the extensibility API can do and not something we would encourage developers doing anyway.
Why does overriding an entire module make sense for your customisation?
m
We’re not overriding all the modules, but for some modules we’ve different requirements based on our website features, functionality and theme, that’s why the question.
s
OK, well, conceptually speaking, that is not something you can (or even should) do with the extension framework
m
Thank you for the clarification! Appreciate it. 🙂