NextJS 13.5.4 fails to bundle @cortex-js/compute-engine.
It tries to bundle a cjs file as an esm module, resulting in a missing constructor for ComputeEngine.
Steps to Reproduce
A minimal example to reproduce the issues can be found on StackBlitz.
Actual Behavior
The following error message occurs in the associated minimal example.
Attempted import error: 'ComputeEngine' is not exported from '@cortex-js/compute-engine' (imported as 'ComputeEngine').
Import trace for requested module:
./src/app/exercises/calculus/[seed]/page.tsx
⨯ src/app/exercises/calculus/[seed]/page.tsx (33:15) @ eval
⨯ TypeError: _cortex_js_compute_engine__WEBPACK_IMPORTED_MODULE_5__.ComputeEngine is not a constructor
at eval (./src/app/exercises/calculus/[seed]/page.tsx:43:20)
at Exercise (./src/app/exercises/calculus/[seed]/page.tsx:42:70)
31 |
32 | const polynomial = useMemo(() => {
> 33 | const ce = new ComputeEngine();
| ^
34 |
35 | return ce.box([
36 | "Add",
Expected Behavior
I would expect Webpack to only exclusively import the cjs or esm files.
I have proposed a fix in #124.
Description
NextJS
13.5.4
fails to bundle@cortex-js/compute-engine
. It tries to bundle acjs
file as anesm
module, resulting in a missing constructor forComputeEngine
.Steps to Reproduce
A minimal example to reproduce the issues can be found on StackBlitz.
Actual Behavior
The following error message occurs in the associated minimal example.
Expected Behavior
I would expect Webpack to only exclusively import the cjs or esm files.
Environment
MathLive version 0.17.0
Operating System macOS
Browser Safari
NextJS 13.5.4