Skip to content

Allow referencing modules outside of node_modules folder with @angular/compiler-cli 5.0.0 #8308

@mlakmal

Description

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

Versions.

angular 5.0.0
ngtools/webpack 1.8.0

Repro steps.

we have application that uses umd angular libraries which reference current application modules. with new compiler-cli this is not supported as it does a check if module resides within node_modules folder. with old cli we were able to use webpacl alias's to resolve this. but seems like with new version we are not able to complete this change.

Gives below error:
Error: Trying to import a source file from a node_modules package: import /Users/123/stash/features/xyz-ui/app/xyz/core/coreModule.ts from /Users/123/stash/features/xyz-ui/node_modules/@ xyz/ux/ux.ngfactory.ts

Ex:
our application has core module under app/core/coreModule.ts and also contains app/core/public_api.ts (which exports coreModule.ts)
application also uses umd bundled library from node_modules/@xyz/ux folder using @xyz/ux import. and this folder reference app/core/coreModule through @xyz/core import.
our build tscofnig contains paths to point @xyz/core to app/core/public_api.ts.

with new compiler and ngtool/webpack builder we are not able to build the app as compiler_host.ts throws error from below line.

https://github.com/angular/angular/blob/3db7112b89c609389abd8b48b0610f9c6f9510a6/packages/compiler-cli/src/transformers/compiler_host.ts#L579

Appreciate if this can be resolved with next minor version.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions