You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error: Webgazer extension failed to initialize. webgazer.js not loaded. Load webgazer.js before calling initJsPsych()
at JsPsych.<anonymous> (http://localhost:3000/js/app.js:31248:15)
at Generator.throw (<anonymous>)
at rejected (http://localhost:3000/js/app.js:27640:32)
How can I load webgazer.js before calling initJsPsych()?
The text was updated successfully, but these errors were encountered:
Modified the build.config.mjs to add the script and recreate the html.
importHtmlWebpackPluginfrom'html-webpack-plugin';/** @param {import("webpack").Configuration} config */exportfunctionwebpack(config){// Find the HtmlWebpackPlugin instance in the plugins arrayconsthtmlWebpackPluginIndex=config.plugins.findIndex(plugin=>plugininstanceofHtmlWebpackPlugin);if(htmlWebpackPluginIndex!==-1){// Modify the HtmlWebpackPlugin options to include webgazer.jsconstoriginalOptions=config.plugins[htmlWebpackPluginIndex].userOptions;config.plugins[htmlWebpackPluginIndex]=newHtmlWebpackPlugin({
...originalOptions,scriptLoading: 'blocking',templateContent: ({ htmlWebpackPlugin })=>`<!DOCTYPE html><html><head> <meta charset="utf-8"> <title>first-experiment (Development Build)</title> <meta http-equiv="X-UA-Compatible" content="ie=edge"> <meta name="viewport" content="width=device-width, initial-scale=1.0"> <script src="https://cdn.jsdelivr.net/gh/jspsych/jspsych@[email protected]/examples/js/webgazer/webgazer.js"></script> <script defer src="js/app.js"></script> <link href="css/main.css" rel="stylesheet"></head><body></body></html><!DOCTYPE html><html>`});}returnconfig;}
However, in future if jspsych-builder would add/change anything from the default html template, this may not work. Is there a better way to get this working?
I do not have experience with webpack that much. Can you please point out on how I can add additional javascript extensions in the
experiment.ts
file?Here is what I tried inside the
run
function:But I get the following error while running:
How can I load webgazer.js before calling
initJsPsych()
?The text was updated successfully, but these errors were encountered: