leonardfactory / babel-plugin-transform-typescript-metadata

Babel plugin to emit decorator metadata like typescript compiler

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add info about resolving bundler warnings to README

gshokanov opened this issue · comments

Hey!
When using this plugin I found that webpack complains about missing exports due to types not being removed by babel when used in inversify decorators. Although everything works fine these warnings can be resolved by using type imports:

import { injectable, inject } from 'inversify';
import type { Service } from './Service';
import { ServiceIdentifier } from './ServiceIdentifier';

@injectable
export class OtherService {
  constructor(
    @inject(ServiceIdentifier) service: Service
  ) {}
}

Just a small suggestion to add this to README if you think it fits there as some people might want to get rid of the warnings but don't know how.

BTW I don't have any experience writing Babel plugins but maybe it's possible to automatically rewrite imports this way through the plugin?

Hey!
When using this plugin I found that webpack complains about missing exports due to types not being removed by babel when used in inversify decorators. Although everything works fine these warnings can be resolved by using type imports:

import { injectable, inject } from 'inversify';
import type { Service } from './Service';
import { ServiceIdentifier } from './ServiceIdentifier';

@injectable
export class OtherService {
  constructor(
    @inject(ServiceIdentifier) service: Service
  ) {}
}

Just a small suggestion to add this to README if you think it fits there as some people might want to get rid of the warnings but don't know how.

thx you for this solution. if README have this tip, I think it's very useful.

I'll add it to README in the pitfalls section. Thank you 😄