Skip to content

Commit c0c37fc

Browse files
committed
refactor: get component expose name from manifest
1 parent 85c964d commit c0c37fc

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/webpack.config.ts

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const ngJson = readJsonFromVisual('angular.json');
88
const projectName = env.VISUAL_NAME!;
99
const visualRoot = ngJson.projects[projectName].root;
1010
const sourceRoot = ngJson.projects[projectName].sourceRoot;
11-
const pkgJson = readJsonFromVisual(visualRoot + '/package.json');
11+
const pkgJson = readJsonFromVisual(`${visualRoot}/package.json`);
1212
const exposes = {};
1313

1414
const getDirectories = (source: string) =>
@@ -17,8 +17,10 @@ const getDirectories = (source: string) =>
1717
.map(dirent => dirent.name);
1818

1919
getDirectories(sourceRoot).forEach(dir => {
20-
if (existsSync(`${sourceRoot}/${dir}/manifest.json`)) {
21-
const exposedModule = capitalize(camelCase(dir));
20+
const manifestPath = `${sourceRoot}/${dir}/manifest.json`;
21+
if (existsSync(manifestPath)) {
22+
const manifestJson = readJsonFromVisual(manifestPath);
23+
const exposedModule = capitalize(camelCase(manifestJson.name));
2224
exposes[exposedModule] = `./${sourceRoot}/${dir}`;
2325
}
2426
});

0 commit comments

Comments
 (0)