Hi team,
We've integrated Bryntum Scheduler into our react app and we run into these errors when we try and run our tests.
The error is:
/frontend/node_modules/@bryntum/scheduler-react/lib/index.js:1
export * from './BryntumFullscreenButton';
^^^^^^
SyntaxError: Unexpected token 'export'
at Object.compileFunction (node:vm:352:18)
at wrapSafe (node:internal/modules/cjs/loader:1031:15)
at Module._compile (node:internal/modules/cjs/loader:1065:27)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
at Module.load (node:internal/modules/cjs/loader:981:32)
at Function.Module._load (node:internal/modules/cjs/loader:822:12)
at Module.require (node:internal/modules/cjs/loader:1005:19)
at require (node:internal/modules/cjs/helpers:102:18)
at Object.<anonymous> (/frontend/src/associates/ganttChart/GanttChart.tsx:2:1)
We are using React and TypeScript as well as mocha, chai and enzyme for our tests.
test command:
"test": "npm run testBuild; mocha -r tsconfig-paths/register ./build/transpiled/**/*.spec.js --reporter dot --exit;",
Where testBuild is:
"testBuild": "rm -rf ./build/transpiled/*; set -e; tsc --project tsconfig-for-tests.json"
I think it could be related to commonjs vs esmodules but I'm not sure how to resolve it in the best way.
In our tsconfig.json, we have our
"module": "commonjs"
How we're importing Bryntum Scheduler:
import React, { Fragment, FunctionComponent } from 'react';
import { BryntumScheduler } from '@bryntum/scheduler-react';
import { schedulerConfig } from './GanttChartConfig';
const GanttChart: FunctionComponent = () => {
return (
<Fragment>
<BryntumScheduler {...schedulerConfig} />
</Fragment>
);
};
export default GanttChart;
Please let me know if you need more information or would like to connect on a Zoom call for debugging purposes. We really need to resolve this issue to release our feature with this library.
Thanks!