I am currently learning JavaScript and have been following a course on Domestika that requires me to install the Tweakpane package. I usually use Git Bash for installing packages, and I have successfully installed others this way before. Here is the process I used to try and install Tweakpane:
$ npm install --save tweakpane
$ npm install --save-dev @tweakpane/core
Although there were no errors during installation, when I attempted to open my JS file, I encountered the following error:
ParseError: 'import' and 'export' may appear only with 'sourceType: module'
line 7788
sketches\node_modules\tweakpane\dist\tweakpane.js
export { BladeApi, ButtonApi, FolderApi, ListBladeApi, ListInputBindingApi, Pane, Semver, SeparatorBladeApi, SliderBladeApi, SliderInputBindingApi, TabApi, TabPageApi, TextBladeApi, TpChangeEvent, VERSION };
^
I have searched online for solutions related to similar issues with other packages, including installing the core package, but none of them have worked so far. I believe there might be some mistake in my approach.
If anyone could provide guidance on how to resolve this issue and suggest steps to troubleshoot it, I would greatly appreciate it. Please let me know if you need any additional information.
EDIT: As a temporary solution, I checked Tweakpane's GitHub repository and discovered that they switched to ES modules from version 4 onwards, which is the version I had installed. I uninstalled that version and opted for version 3 instead, which resolved the problem. However, I am still interested in understanding more about ES modules and fixing the initial error I encountered.
Thank you!