svelte-gantt icon indicating copy to clipboard operation
svelte-gantt copied to clipboard

Can svelte-gantt be used in SSR?

Open winston0410 opened this issue 2 years ago • 4 comments

Right now svelte-gantt is used in onMount only for client-side rendering, is it possible for it to render server side as well and not rely on document?

winston0410 avatar Nov 21 '21 21:11 winston0410

Adding is it possible to use with sveltekit?

Avi-ADAM avatar Jun 13 '22 16:06 Avi-ADAM

Concerning the SSR, I think the current structure doesn't allow it. But you can of course use it with sveltekit since you it's compiled in pure js. Did you run into a problem doing so ?

V-Py avatar Jun 15 '22 06:06 V-Py

Concerning the SSR, I think the current structure doesn't allow it. But you can of course use it with sveltekit since you it's compiled in pure js. Did you run into a problem doing so ?

not until the new update im getting this error (node:19828) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension. (Use node --trace-warnings ...` to show where the warning was created) Unexpected token 'export' C:\Users\node_modules\svelte-gantt\index.js:7180 export { MomentSvelteGanttDateAdapter, SvelteGantt, SvelteGanttDependencies, SvelteGanttExternal, SvelteGanttTable }; ^^^^^^

SyntaxError: Unexpected token 'export' at Object.compileFunction (node:vm:352:18) at wrapSafe (node:internal/modules/cjs/loader:1027:15) at Module._compile (node:internal/modules/cjs/loader:1063:27) at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10) at Module.load (node:internal/modules/cjs/loader:975:32) at Function.Module._load (node:internal/modules/cjs/loader:822:12) at ModuleWrap. (node:internal/modules/esm/translators:170:29) at ModuleJob.run (node:internal/modules/esm/module_job:198:25) at async Promise.all (index 0) at async ESMLoader.import (node:internal/modules/esm/loader:409:24) this also shows every server startsvelte-gantt doesn't appear to be written in CJS, but also doesn't appear to be a valid ES module (i.e. it doesn't have "type": "module" or an .mjs extension for the entry point). Please contact the package author to fix.`

Avi-ADAM avatar Sep 12 '22 11:09 Avi-ADAM

Hey I've also encountered this issue, I've discovered it because this packages is not quite conforming to the node.js module spec https://github.com/vitejs/vite/issues/5939#issuecomment-985176340

easy fix is to add "type": "module" to the package.json

Jakeii avatar Mar 11 '23 11:03 Jakeii