Giter VIP home page Giter VIP logo

first-di's Issues

Problems on build time

Trying to use this lib as described in readme, but got this error on build time:

> Build error occurred
/node_modules/first-di/dist/index.js:1
export * from "./classes/di";
^^^^^^

SyntaxError: Unexpected token 'export'

0.1.38 doesn't work (webpack5)

WARNING:
export 'reflection' (imported as 'reflection') was not found in 'first-di' (possible exports: autowired, instance, override, reset, resolve, singleton)

ERROR in ./node_modules/first-di/dist/index.mjs 3:0-45
Module not found: Error: Can't resolve './models/autowired-lifetimes' in '...\node_modules\first-di\dist'
Did you mean 'autowired-lifetimes.js'?
BREAKING CHANGE: The request './models/autowired-lifetimes' failed to resolve only because it was resolved as fully specified
(probably because the origin is a '.mjs' file or a '.js' file where the package.json contains '"type": "module"').
The extension in the request is mandatory for it to be fully specified.
Add the extension to the request.

Class field decorated with @autowired is undefined

Expected behavior

  @autowired()
  private readonly myService!: AService;

  private readonly myStr: string;

  constructor() {
     this.myStr = "test";
  }

  public foo():string {
      return this.myService.getObj();
  }

Call of foo method returns string

Actual behavior

this.myService is undefined insade foo method

  @autowired()
  private readonly myService!: AService;

  private readonly myStr: string;

  constructor() {
     this.myStr = "test";
  }

  public foo():string {
      return this.myService.getObj();
      //TypeError: Cannot read properties of undefined
  }

Steps to reproduce behavior:

  1. typescript version >=3.7
  2. set useDefineForClassFields: true in tsconfig.json

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.