Skip to content

Type only import not deleted from result file #9

@anion155

Description

@anion155

Import of types error (cyclic import is imported, cause it does breaks functionality):

// a.js
import { B } from '@/b';
import { NotRuntime } from '@/c';

export class A {
    constructor(public name: NotRuntime) {}
}

export const b = new B();
b.print(new A('This is a random name'));

// b.ts
import { A } from '@/a';

export class B {
    print(a: A) {
        console.log(a.name);
    }
}

// c.ts
export type NotRuntime = string;
throw new Error('Should never happen, until `import "@/c"`');

Produces invalid code with circular dependencies. When without paths and this plugin, resulting b.js does not content require('./a.js'), which resolves circular dependency error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions