Unexpected token no import

0

You are giving the following syntax error in the typed.js plugin:

Uncaught SyntaxError: Unexpected token {

On these lines:

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

I do not think this was going to happen, why does he blame this error?

    
asked by anonymous 07.03.2018 / 14:46

1 answer

1

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

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

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

    
07.03.2018 / 15:14