Page 1 of 1

[REACT] npm run build error when importing import { Store,Model } from '@bryntum/scheduler'

Posted: Fri Jan 27, 2023 12:20 am
by jcelda

Hi,

version: bryntum scheduler version 5.2.3 and also tried with version 5.2.8

We are using next.js too ( if this helps...)

We developed a piece a code that uses the Core.data.Store standalone. For standalone I meant not using the scheduler component directly.

we put the following import:

import { Store,Model } from '@bryntum/scheduler'

in our component and instanciated a store with

new ┬┤Store({ data: dataArray})...

It works well in development mode but when we try to do a build, we get the following error:

# npm run build
....
.C:\git\ldsc-front\node_modules\@bryntum\scheduler\scheduler.module.js:178813
export { AbstractAssignmentStoreMixin, AbstractCalendarManagerStoreMixin, AbstractCalendarMixin, AbstractCrud... and a lot more of exports... 

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.9933 (C:\git\ldsc-front\.next\server\pages\dashboard-launch\dcvview.js:8805:18)
    at __webpack_require__ (C:\git\ldsc-front\.next\server\webpack-runtime.js:25:43)

Build error occurred
Error: Failed to collect page data for /dashboard-launch/dcvview
    at C:\git\ldsc-front\node_modules\next\dist\build\utils.js:916:15 {
  type: 'Error'
}

We don't know exactly where the problem is...

Can you please help?


Re: [REACT] npm run build error when importing import { Store,Model } from '@bryntum/scheduler'

Posted: Fri Jan 27, 2023 5:08 am
by alex.l

Hi!

Please refer to this guide here
https://www.bryntum.com/docs/gantt/guide/Gantt/integration/react/guide#loading-components-dynamically-with-nextjs

Using dynamic import will help to solve this issue because Scheduler component can not be rendered on server side.