R
R
romaro2021-09-29 15:28:27
JavaScript
romaro, 2021-09-29 15:28:27

Why doesn't parent class import work?

If I import the class directly from the file, then everything works:

import { BaseController } from "../../core/lib/BaseController.js";

export class TestController extends BaseController {
    constructor(logger) {
        super(logger);
        this.logger.debug(`${this.constructor.name} -> Initilazed`);
    }
    // some code
}


But if I create an index file:
export { BaseController } from './lib/BaseController.js';


And I try to import from it:
import { BaseController } from "../../core/index.js";


Then I get an error:
Cannot access 'BaseController' before initialization


How to work with re-export in Node? Version 14.16

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vitaly, 2021-09-29
@vshvydky

base: some:
export class Base {...}
export class Some extends Base {..}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question