angulartypescriptwebpackwebbrowser-control

Can't access lexical declaration 'rm' before initialization


im working on a Angular 13 project using webpack and recently I started getting this error after making base classes and adding more inheritance:

Can't access lexical declaration 'rm' before initialization

Error in detail

I know this is some kinda hoisting problem and Im already organising my project to have export files where I export each folder seperately. I got that error before and fixed it by using the export files, but this is kinda different. I dont know where "rm" is coming from and the sourcemap stopped working too. This is in dev mode on a local server (ng serve). I have no clue which files could cause that error.

My export files look like that

/** Base interfaces */
export * from './base/i-plan.interface'
export { IInteractive } from './i-interactive-object.interface'
export { IInteractivePlan } from './i-interactive-planer-object.interface'
export { IElementBase } from './i-element-base.interface'

/** Base classes */
export * from './base/column-base'
export * from './base/cube-base'
export * from './base/element-base'

/** 3D Components */
export * from './base/column-3d-base'
export * from './base/cube-3d-base'
export * from './base/element-3d-base'
export * from './base/system-base'
export * from './base/plan-base'

/** Specific implementations */
export * from './piece'
export * from './transfer-object-base'
export * from './selection-history'

Importing like that

import { Planer, Piece } from 'ts-planer';

This is the line which the error is point

import * as THREE from 'three'
import { RoomObject3D } from './view/room-object-3d'

... imports
export class RoomObject3D extends Object3DBase implements IInteractiveRoomObject {

Any help appreaciated! Let me know if I can give more information Thanks

Update: I got the sourcemap to work again. I know which file is not initialized now. I dont really know what to do next. The project is pretty big and I implemented these base classes, which affected quite a wide range of files in the project. How can I track back or how do I find out how to order the imports and exports?


Solution

  • I solved it by removing exports that didnt follow the folder structure. They were accidentally created when moving files.

    For example I was having in the root index file exports of UI elements that have their own index file.