Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

234
Visualizações
When trying to use import statement I get Uncaught SyntaxError: Unexpected token '{'

I am making a website and I am trying to import a script. Whenever I try to import the script I get Uncaught SyntaxError: Unexpected token '{' . I am using express to show the website and it is just returning a html file.

This is the script tag that I am using to access the main script.

<script type="module" src="./main.js" defer>

This is the code in the main file

.then(function(data) {
    data.forEach(function(currentdevice) {
    import { testvalue } from "./DeviceManager/" + currentdevice.Type;
});

Basically currentdevice.Type is the file name and I checked it is correct.

For the file that I am trying to import I just have a bit of example code why I try to get import to work.

export const testvalue = 'test';

I have looked on google and I was unable to personally find anything.

about 4 years ago · Juan Pablo Isaza
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda