Typical examples of using Sitecore JSS with TypeScript involve using ts-node
for the manifest generation process to compile manifest definition files. ts-node
uses standard node resolution process to resolve modules, it does not respect the paths
property from tsconfig.json
which is a TypeScript compiler feature.
If you want to use the TypeScript compiler path mapping feature for manifest generation, it is recommended to use the tsconfig-paths
library: https://github.com/dividab/tsconfig-paths
Then you simply need to register tsconfig-paths
in config.js
when you register ts-node
and be sure they are both configured to use the same tsconfig.json
file. This can easily be done by setting the TS_NODE_PROJECT
environment variable.
Also be sure that the paths
and baseUrl
properties are properly set in the tsconfig.json
file you use for manifest generation. Manifest generation is a separate process from building your JSS+TypeScript app, so it will typically make more sense to