jspsych-builder icon indicating copy to clipboard operation
jspsych-builder copied to clipboard

jspsych-psychophysics plugin in the builder

Open franfrutos opened this issue 3 years ago • 1 comments

I would be interested in using the jspsych-psychophysics plugin. Unfortunately it doesn't seem to be available for use via npm. Is there any way I can use the plugin code to make it accessible for use with jspsych builder?

Thanks in advance, and sorry if this is a trivial question.

franfrutos avatar Sep 26 '22 16:09 franfrutos

Hi @franfrutos, this is everything but trivial :smile: The root problem is that jspsych-psychophysics is not available as an ES module. This is the same problem as https://github.com/jspsych/jspsych-contrib/issues/26#issuecomment-1099160930. The reason jspsych-builder doesn't support jspsych-psychophysics out of the box is that jspsych-builder's builtin compatibility hack only applies to @jspsych-contrib-scoped packages that don't export modules. You can manually work around it via

import jsPsychPsychophysics from "imports-loader?type=commonjs&imports=single|jspsych|jsPsychModule!exports-loader?type=commonjs&exports=single|jsPsychPsychophysics!./jspsych-psychophysics.js";

@tpronk @kurokida so you get a notification too

bjoluc avatar Sep 30 '22 13:09 bjoluc