Hello!
I’ve been out of the loop for a few years, and this is literally the first time I’ve looked at JS - so please bear with me!
I’m currently trying to import the JS version of the python itertools package into Pavlovia - but whenever either use import
or include a link to the script in index.htm
I get a ‘exports not defined’ error.
I understand that this might be due to differences in compilers (commonJS vs ES6 or something) - but I also see that export and import are used extensively in the PsychoJS library, so I’m not sure it can’t find the definition.
I’m currently editing the js file directly because of issues with psychopy builder on my computer.
I’ve tried the following:
# In the JS file
import * as itertools from './node_modules/itertools/itertools.js'
# In Index.htm
<script type="text/javascript" src = "./node_modules/itertools/itertools.js"></script>
I have tried both methods with both the named js files and the index.js files which is meant to (but doesn’t) import everything.
Any advice on how to fix this would be much appreciated!
BW
Oli
EDIT
Here’s a minimal example: