Skip to content

Enabling different build targets for jsPsych plugins #3545

@teonbrooks

Description

@teonbrooks

Wanted to start a discussion and track the issue around build targets for jsPsych.

We're currently developing a plugin https://github.com/teonbrooks/plugin-voice-response that enables speech transcription but we're currently running into a problem where we get the following error:

[!] (plugin esbuild) Error: Transform failed with 15 errors:
<stdin>:1411:17733: ERROR: Big integer literals are not available in the configured target environment ("es2015")
<stdin>:1411:17760: ERROR: Big integer literals are not available in the configured target environment ("es2015")
<stdin>:1418:24595: ERROR: Big integer literals are not available in the configured target environment ("es2015")
<stdin>:1418:24611: ERROR: Big integer literals are not available in the configured target environment ("es2015")
<stdin>:11941:46: ERROR: Big integer literals are not available in the configured target environment ("es2015")
...

We think the source of this error is caused by our use of transformers.js/onnx-runtime, which uses Big integer literals.

I first fixed this with a hack by going into the node_modules of my plugin and editing the jspsych/config library directly by changing the build target from es2015 to es2020 in the Minified production IIFE build section. This made the error go away.

We decided to patch this the proper why by modifying the rollup.config.mjs within our plugin and reverting back the hack, but the error above seems to have returned and I don't know why.
cf. https://github.com/teonbrooks/plugin-voice-response/blob/dev-transformers/rollup.config.mjs

A few questions:

  1. Does this config file seem alright? I was looking for a way to only modify the part of the config file I touched. Feedback is greatly appreciated :)

  2. Is it possible to have different build targets for jspsych core and jspsych plugins?

  3. I see that all the other build steps use esnext instead of a specified year. Changing it to esnext in jsPsych directly fixes the error as well. Could that be used without breaking other users' setup? If so, that would be the easiest solution.

cc: @becky-gilbert @jodeleeuw @jkhartshorne

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions