Skip to content

Generated library's ng-package.json file creates the wrong output file path reference for the build system #11017

Closed
@bh3605

Description

@bh3605

I'm submitting a...


[ x ] Bug report 

Current behavior

After building a library using the Angular CLI, app cannot find a reference to library when importing in app.module.ts

Expected behavior

It finds a proper reference to MyTestLibrary.

Minimal reproduction of the problem with instructions

Create a library containing capital letters like MyTestLibrary with the command
ng g library MyTestLibrary

Build MyTestLibrary with command ng build MyTestLibrary
Import library in app.module.ts with import { MyTestLibraryComponent } from 'MyTestLibrary';
see error: can not find module MyTestLibrary

What is the motivation / use case for changing the behavior?

The Angular CLI is not providing a proper reference to where the build system outputs the library.

I found the library's generated ng-package.json file is using the libary's hyphenated form instead of the actual name of the library. The generator is also providing a file reference so you can actually reference your built library in tsconfig.json. These 2 file paths are differing. That's the problem. The build system will output your library to dist/my-test-library while your app only has an expected reference of dist/MyTestLibrary.

Environment

Any


Angular CLI version: 6.0.0

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions