Skip to content

Setting root in CLI json with TS paths fails AOT Compilation #7333

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
intellix opened this issue Aug 10, 2017 · 3 comments
Closed

Setting root in CLI json with TS paths fails AOT Compilation #7333

intellix opened this issue Aug 10, 2017 · 3 comments

Comments

@intellix
Copy link
Contributor

Bug Report or Feature Request (mark with an x)

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

Versions.

@angular/cli: 1.3.0
node: 8.2.1
os: darwin x64
@angular/animations: 4.3.3
@angular/common: 4.3.3
@angular/compiler: 4.3.3
@angular/core: 4.3.3
@angular/forms: 4.3.3
@angular/http: 4.3.3
@angular/platform-browser: 4.3.3
@angular/platform-browser-dynamic: 4.3.3
@angular/router: 4.3.3
@angular/cli: 1.3.0
@angular/compiler-cli: 4.3.3
@angular/language-service: 4.3.3

Repro steps.

  1. Create an app with multiple apps like red and blue inside src and a core
  2. Create multiple apps that have a root pointing to those sub-folders
  3. ng build --aot

Reproduction:

  1. Clone https://github.com/intellix/angular-cli-library
  2. ng build --aot

The log given by the failure.

✖ 542 /Sites/gith…/inte…/angular-cli-library (master)* › ng build --aot
Date: 2017-08-10T09:46:53.519Z
Hash: acecd85abdc522946e8c
Time: 6578ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 23.5 kB {vendor} [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 204 kB {inline} [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 11.8 kB {inline} [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 882 kB [initial] [rendered]

ERROR in /Sites/github/intellix/angular-cli-library/src/red/$$_gendir/core/components/header/header.component.ngfactory.ts (11,21): Cannot find module './header.component'.
ERROR in /Sites/github/intellix/angular-cli-library/src/red/$$_gendir/core/core.module.ngfactory.ts (10,21): Cannot find module './core.module'.
ERROR in /Sites/github/intellix/angular-cli-library/src/red/$$_gendir/app/app.component.ngfactory.ts (11,21): Cannot find module '../../../core/components/header/header.component.ngfactory'.
ERROR in ./src/red/$$_gendir/app/app.component.ngfactory.ts
Module not found: Error: Can't resolve '../../../core/components/header/header.component.ngfactory' in '/Sites/github/intellix/angular-cli-library/src/red/$$_gendir/app'
resolve '../../../core/components/header/header.component.ngfactory' in '/Sites/github/intellix/angular-cli-library/src/red/$$_gendir/app'
  using description file: /Sites/github/intellix/angular-cli-library/package.json (relative path: ./src/red/$$_gendir/app)
    Field 'browser' doesn't contain a valid alias configuration
  after using description file: /Sites/github/intellix/angular-cli-library/package.json (relative path: ./src/red/$$_gendir/app)
    using description file: /Sites/github/intellix/angular-cli-library/package.json (relative path: ./src/core/components/header/header.component.ngfactory)
      no extension
        Field 'browser' doesn't contain a valid alias configuration
        /Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory doesn't exist
      .ts
        Field 'browser' doesn't contain a valid alias configuration
        /Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory.ts doesn't exist
      .js
        Field 'browser' doesn't contain a valid alias configuration
        /Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory.js doesn't exist
      as directory
        /Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory doesn't exist
[/Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory]
[/Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory.ts]
[/Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory.js]
[/Sites/github/intellix/angular-cli-library/src/core/components/header/header.component.ngfactory]
 @ ./src/red/$$_gendir/app/app.component.ngfactory.ts 9:0-81
 @ ./src/red/$$_gendir/app/app.module.ngfactory.ts
 @ ./src/red/main.ts
 @ multi ./src/red/main.ts

Desired functionality.

We've got a huge core set of components, services, modules and we'd like to be able to theme them by providing new SCSS variables, Images and potentially a different composition of Modules and Components etc.

Essentially a white-labelling solution, imagine Coca Cola and Pepsi sharing the same codebase but all that changes is the colours and logos

Mention any other details that might be useful.

What I've got is based off of a solution by @nekkon and as suggested by @grizzm0 I could change the root property instead to greatly clean things up.

@nekkon
Copy link

nekkon commented Aug 10, 2017

@intellix As I have mentioned here , there are open issues with angular-cli that do not allow your suggestion/solution/examples to work. ( ex. 7087 ). You can use the library template which is a workaround of all these open issues. It will take time for all of them to be solved, if ever.

@Brocco
Copy link
Contributor

Brocco commented Aug 18, 2017

@nekkon is correct, follow the guide provided.

Support for libraries is being planned for the CLI.

@Brocco Brocco closed this as completed Aug 18, 2017
@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants