Skip to content

Commit ee0b9fd

Browse files
author
Tim Lindvall
committed
fix: Use addon's moduleName() if present.
1 parent 054f124 commit ee0b9fd

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

ts/lib/commands/precompile.ts

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -53,8 +53,9 @@ export default command({
5353
// addon name from its package name, we use the addon name, since that is
5454
// how it will be written for imports.
5555
let addon = this.project.addons.find((addon) => addon.root === this.project.root);
56-
if (addon && addon.name !== packageName) {
57-
packageName = addon.name;
56+
if (addon) {
57+
let addonName = addon.moduleName ? addon.moduleName() : addon.name;
58+
packageName = addonName;
5859
}
5960

6061
let createdFiles = copyDeclarations(pathRoots, paths, packageName, this.project.root);

ts/types/ember-cli/index.d.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ declare module 'ember-cli/lib/models/addon' {
4040
serverMiddleware(options: { app: Application; options?: TaskOptions }): void | Promise<void>;
4141
testemMiddleware(app: Application, options?: TaskOptions): void;
4242
setupPreprocessorRegistry(type: 'self' | 'parent', registry: PreprocessRegistry): void;
43+
moduleName(): string;
4344
}
4445
}
4546

0 commit comments

Comments
 (0)