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

160
Visualizações
Importing a Node module into a Sinatra app

I have a minimal Sinatra app for testing out the Britecharts data visualization library (installed as a Node module) locally. I'm having trouble accessing the library files in my Sinatra views.

My public/js/chart.js has the following import:

import bar from './britecharts/node_modules/britecharts/dist/umd/bar.min.js';

The path to the file is valid (I can access it if I paste the path into the browser address bar). However in the dev console I get an error saying:

Uncaught SyntaxError: import not found: default

I then put brackets around the variable, as explained in this guide:

import { bar } from './britecharts/node_modules/britecharts/dist/umd/bar.min.js';

But then I get this error instead:

Uncaught SyntaxError: import not found: bar

Thanks for the help.

[EDIT 04.01.2022]: I've created a GitHub repo for the app:

https://github.com/fullstackplus/britecharts-demo

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