Unexpected token in import

Asked

Viewed 330 times

0

Is giving the following error of syntax in the plugin typed.js:

Uncaught SyntaxError: Unexpected token {

Along those lines:

import { initializer } from './initializer.js';
import { htmlParser } from './html-parser.js';

I don’t think that’s supposed to happen, because he accuses this mistake?

  • 1

    The error must be inside one of these . js

  • 1

    Which browser are you using?

  • Using Chrome, the JS file that is giving error is this: https://lucasdecarvalho.com/guiacomercialnf/_Cdn/typed.js

  • Take a look at line 353 and 354, that’s correct?

1 answer

1

You are using a JS file that works as a module (see an answer about modules here).

To use the resource import module, you need to load the script with the attribute type="module":

<script type="module" src="typed.js"></script>

inserir a descrição da imagem aqui

inserir a descrição da imagem aqui

  • dvd, thanks! But now is giving a different error:

  • The server responded with a non-JavaScript MIME type of "text/html"

  • Can you tell me what it can be?

  • Vc tah using on server or computer?

  • Apache server

  • If you have another browser other than IE, try opening it to see if the error occurs.

Show 1 more comment

Browser other questions tagged

You are not signed in. Login or sign up in order to post.