Rails and PapaParse with stimulus.js and importmap.rb

46 views Asked by At

I am pretty new with importmap and with javascript so my question might not be relevant but i am stuck :/

I would like to use the PapaParse library in one of my view to parse a csv and add rows into a table

In my importmap.rb i have :

pin 'papaparse', to: 'https://unpkg.com/[email protected]/papaparse.min.js'

and in my stimulus controller :

import Papa from 'papaparse';

but it does not work, in my browser i can see the following error :

The requested module 'papaparse' does not provide an export named 'default'

Any idea of how to make this work ? :/

Tom

Everything, the js file can not be imported correctly

0

There are 0 answers