Skip to content

Angular v5 compiler rewrites imports #19026

Closed
@Eddman

Description

@Eddman

I'm submitting a...


[x] Regression (a behavior that used to work and stopped working in a new release)

Current behavior

I'm using TypeScript paths to define a sub-module in my repo:

{
    "compilerOptions": {
        "baseUrl": ".",
        "rootDir": ".",
        "paths": {
            "@my-org/my-sub-module": [
                "./src/my-sub-module/public_api.ts"
            ]
        }
    }
}

Then in a .ts file I use the import:

import {some_class} from '@my-org/my-sub-module';

When I compile using NGC it resolves the imports correctly, but sometimes replaces it with relative path in the output files:

import { some_class } from "./../my-sub-module/public_api";

This is fine for base usage, but once I try to use rollup to bundle packages based on the paths it will try to include files that do not belong to my sub-module. The roots in paths are passed into external option of rollup. But these do not match the rewritten paths anymore...

The code was working fine in Angular 4.3.x.

Expected behavior

The imports are never replaced with relative paths.

Minimal reproduction of the problem with instructions

Can't find any pattern for which the imports are modified. It seems to be that they are changed once the relative path is shorter then the name in paths(?)...

Environment

Angular version: 5.0.0-beta.6
TypeScript: 2.3.4

Metadata

Metadata

Assignees

Labels

area: coreIssues related to the framework runtimeregressionIndicates than the issue relates to something that worked in a previous version

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions