Skip to content

npm run build --prod strip decorators meta #1

@kingfolk

Description

@kingfolk

The following code reproduce SomeComponent is not injectable. Because design:paramtypes metadata is stripped by Angular during production build.

import {Dilight, Injectable, Module, Injector} from 'dilight';

@Injectable()
class ServiceA {}

@Injectable()
class ServiceB {
  constructor(private a: ServiceA) {}
}

@Module({
  providers: [ServiceB],
})
class SomeComponent {
  constructor(public childInjector: Injector) {}
}

const parentInjector = Dilight.new();
const comp = parentInjector.get(SomeComponent);

// will log false
console.log(comp.childInjector.get(ServiceB) === parentInjector.get(ServiceB));

// will log true
console.log(comp.childInjector.get(ServiceA) === parentInjector.get(ServiceA));

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions