V
V
Vadim kyklaed2018-03-29 12:09:45
JavaScript
Vadim kyklaed, 2018-03-29 12:09:45

SyntaxError: import declarations may only appear at top level of a module - what is the cause of the error?

Good afternoon! tell me what is the problem with the error
SyntaxError: import declarations may only appear at top level of a module
doing import

Answer the question

In order to leave comments, you need to log in

5 answer(s)
R
RidgeA, 2018-03-29
@kyklaed

60f3b07aa33b82ba986e082e4f68585b.jpg
Is the code transpiled in some way or does it get into the browser in this form?
If the second - https://jakearchibald.com/2017/es-modules-in-browsers/

R
Roman Kitaev, 2018-03-29
@deliro

import declarations may only appear at top level of a module

import declarations may only appear at top level of a module

I
Ivan, 2018-03-29
@LiguidCool

Well, apparently you placed the import somewhere in the wrong place. In so Wangi is on vacation.

M
Marat Nagayev, 2018-03-29
@nagayev

It is written, import only at the beginning of the module.

S
Serge Tkach, 2018-09-01
@SergeTkach

Solved a similar problem as follows:
Just connect:
Replaced with a connection indicating the type:
Inspired here .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question