angularscullyscullyioangular-scully

Putting extraRoutes in separate file for multiple configuration in Scully results in importerror


I have multiple scully configurations:

scully.en.config.ts
scully.de.config.ts

The scully config has a extraRoutes fields which is same for all the configs. I want to put the extraRoutes in a new file extraRoutes.ts.

export const extraRoutes = [
   '/',
   '/about', etc...
]

And importing that file in configs

import { extraRoutes } from './extraRoutes';

But I am getting Error: Cannot find module './extraRoutes' while I try to run npx scully --project en.


Solution

  • The config file is automatically compiled during the Scully run. However, it does not know about your extra file. There are a couple of options.

    1. compile it manually before run
    2. Move it into the ./scully folder, and check the tsconfig.json there to see if its included (normally it is!)
    3. just rename the file to .js,