Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

155
Views
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
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!