angular / angular-cli

CLI tool for Angular
https://cli.angular.dev
MIT License
26.78k stars 11.98k forks source link

Angular CLI @7 Library Build path references #13318

Closed xavidram closed 5 years ago

xavidram commented 5 years ago

Bug Report or Feature Request (mark with an x)

- [ x] bug report -> please search issues before submitting
- [ ] feature request

Command (mark with an x)

- [ ] new
- [x ] build
- [ x] serve
- [ ] test
- [ ] e2e
- [ ] generate
- [ ] add
- [ ] update
- [ ] lint
- [ ] xi18n
- [ ] run
- [ ] config
- [ ] help
- [ ] version
- [ ] doc

Versions

ng: 7.1.4 Node: 10.13.0 OS: Win 10 x64

Repro steps

  1. Scaffold a new Angular CLI project with the @7 generator.
  2. Generate a new Library using the subgenerator: ng g library libraryname --prefix=xx
  3. Add a Typings file (index.d.ts) under the lib folder of the library
  4. Add a global namespace declaration into the Typings file
  5. Add a path reference to this Typings file
  6. Run the build command for the project: ng build libraryname
  7. Open the dist folder and then the subfolder with the name of the library.
  8. The index.d.ts Typings file will appear within the lib folder, but under the esm5 and esm2015 folders, the public_api.js files contain references to the Typings file which the path is invalid, as these are within a sub folder.

Alternativley, you can add the Typings file right next to the public_api.ts file and add the references, and the paths will still be incorrect.

The log given by the failure

No Error on build, but on serve I recieve: ERROR ReferenceError: atlas is not defined.

Desired functionality

Although this is a Global Namespace inside the typings file, and the Intellisense on VS Code picks it up without having to add any new references in the main application for testing, upon serving the project to test the library, the project is not able to find the namespace.

Mention any other details that might be useful

You can clone and run this project to see the error.

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.