After updating dependencies in #226, starting a new kernel using a production of jupyterlite-pyodide-kernel fails with:
Failed to construct 'Worker': Failed to read the 'type' property from 'WorkerOptions':
Cannot convert object to primitive value
In packages/pyodide-kernel/src/kernel.ts, workers are created with:
new Worker(new URL('./comlink.worker.js', import.meta.url), {
type: 'module',
})
Looking more closely at the built assets:
Dev:
new Worker(new URL(...), {
type: undefined,
})
Prod (minified):
new Worker(new URL(...), {
type: s, // Variable reused - 's' is the pypi import namespace object
})
This seems to be caused by a new version of terser, which likely introduced more aggressive variable reuse optimizations.
The UI tests didn't catch this because they were using the dev build, where the issue doesn't manifest.
After updating dependencies in #226, starting a new kernel using a production of
jupyterlite-pyodide-kernelfails with:In
packages/pyodide-kernel/src/kernel.ts, workers are created with:Looking more closely at the built assets:
Dev:
Prod (minified):
This seems to be caused by a new version of
terser, which likely introduced more aggressive variable reuse optimizations.The UI tests didn't catch this because they were using the dev build, where the issue doesn't manifest.