V
V
Vladimir2020-01-18 01:06:25
typescript
Vladimir, 2020-01-18 01:06:25

Why is the function not imported?

Good afternoon. Please tell me why the function is not imported?
./modules/export.js ./index.js
export default { createScene } //Без ошибок

import createScene = require("./modules/scene"); //Ругается редактор и ошибка после компиляции, предлагает только ts-ignore

UPD:
import { createScene } from "./modules/scene"; //Аналогичная ошибка

Thanks

Answer the question

In order to leave comments, you need to log in

2 answer(s)
S
Stanislav Makarov, 2020-01-18
@Nipheris

./modules/export.js
And the syntax is needed for ES modules:
import createScene from "./modules/scene";

R
Robur, 2020-01-24
@Robur

write like everyone else:
and
or
and
you can write when you can tell why you need it and you will know how to import it correctly

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question