Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

159
Vistas
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 la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda