0

I have Scene.ts file, which imports files from Objects folder

import { Camera, Plane, Cube } from './Objects';

In objects folder i have 4 files:

  1. Camera.ts
  2. Plane.ts
  3. Cube.ts
  4. index.ts

All four files has similar structure

import SceneRenderer from './../SceneRenderer'

export default class Plane/Cube/Camera implements SceneRenderer {

    constructor(public gl:WebGLRenderingContext) {

    }

    draw() {

    }

}

index.ts file exports all classes from others

export { default as Plane } from './Plane';
export { default as Camera } from './Camera';
export { default as Cube } from './Cube';

In src folder i have file Scene.ts file which import all of them:

import { Camera, Plane, Cube } from './Objects';

PROBLEM

src/Scene.ts:1:37 - error TS2307: Cannot find module './Objects'.

What is wrong?!

source code you can find here

1

2 Answers 2

1

Try this,

index.ts should be like this

export * from '/Plane';
export * from '/Camera';
export * from './Cube';

Scene.ts should be like this

import { Plane, Camera, Cube} from './Objects';
Sign up to request clarification or add additional context in comments.

1 Comment

it not works, but i solved my problem adding "moduleResolution": "node" in tsconfig.json
0

i solved my problem adding "moduleResolution": "node" in tsconfig.json. Thanks everyone!

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.