generate an umbraco-package.json file containing the general importmap of the backoffice

This commit is contained in:
Jacob Overgaard
2024-02-13 11:57:03 +01:00
parent d6ea707195
commit 8e1bb6d79a
5 changed files with 29 additions and 1 deletions

View File

@@ -12,7 +12,9 @@ export const createImportMap = (args) => {
const moduleName = key.replace(/^\.\//, '');
// replace ./dist-cms with src and remove /index.js
const modulePath = value.replace(/^\.\/dist-cms/, args.rootDir).replace('.js', '.ts');
let modulePath = value;
if (typeof args.rootDir !== 'undefined') modulePath = modulePath.replace(/^\.\/dist-cms/, args.rootDir);
if (args.replaceModuleExtensions) modulePath = modulePath.replace('.js', '.ts');
console.log('replacing', value, 'with', modulePath)
const importAlias = `${packageJsonName}/${moduleName}`;