I'm using an addon that basically is able to convert CSV files into Jsons or Dictionaries. It used to work well with the scripting mode set to "classic", however this option is no longer available, and my app throws an error when executing and ceses to function.
I'm using papaparse in order to convert CVS files, and I'm not able to import the "Papa" object into the "expresions.js" file where I have the code that construct 3 executes at runtime. With the "classic" scripting mode I could simply use the object, but now it throws an error since it is "undefined". The following snapshot will give you a glance at how the plugin is setup and what my code looks like, as well as the error that it produces:
Attempts at fixing the problem
What I tried first is importing the module using the following statement in the "expresion.js" file, right below the "use strict" directive:
import * as Papa from '../lib/papaparse.min.js
Sadly, an error is thrown indicated that the module can't be loaded. I'm gessing that the path is no longer correct once contruct exports the addon and is using it on runtime.
The file is included in the "addon.json" file's "file-list", and is also indicated as a dependency in the plugin.js file:
Call for action
- How should I import a module with the new scripting system, if not the way I'm doing it nor what I tried to do already?
- Could you point me to an addon that is using a library in a similar way, so I can figure it out through reverse enginiering?
Thank you very much, I look forward to your answers!