Skip to Content
Jul 27, 2020 at 07:02 AM

App Router Extension: how to remove xs-app.json?

178 Views Last edit Jul 27, 2020 at 07:14 AM 2 rev

I’ve defined a route in my extension, passing the options object to the start()command, as described here
xsappContext - An object representing the content which is usually put in xs-app.json file. If this property is present it will take precedence over the content of xs-app.json.

As expected, my route, as defined in options, is being used by app router
So I thought I can remove the xs-app file which is not longer needed
But if I delete the xs-app.json file, then approuter throws an error on startup
This seems to be intended: in environment.js, there’s a check if the file is found

var xsappFile = path.join(wdir,'xs-app.json');
if (!fsUtils.isFile(xsappFile)) {
throw new Error('File not found ' + xsappFile);

I don’t understand why this file is still required, when I pass the route as option. Although I agree, config file is better, in my scenario I want to remove the file. Is there a way to get rid of it?

Kind Regards and thanks for advice