svelte-gantt
svelte-gantt copied to clipboard
after svelteKit update to .480 getting error
after updating to [email protected] i get this error on page that have the gantt `Unexpected token 'export' C:\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.
I'll give it a look asap, until then go back to the previous version, thanks for the feedback !
maby has something to do with node version, I updated to v16.14.2 for the svelteKit update
Definitely about the SvelteKit update and the node version coming with it. I searched a bit last night and got the error in one of my project with the latest SveltKit version, and didn't have the error in another project with an older one. Looks to be a build problem, currently reading some docs about the differences between CommonJS vs ES6 module. I'm not a specialist of this subject, so it might take a while, if someone read this and has time to give it a look and submit a PR would be awesome.
I ask on sveltekit discord Got some questions that I don't know how to answer, maybe can you?
Great idea, I'll have some time to answer on the discord and try to tackle this problem tomorrow and this weekend. Will keep you informed asap
It may be a hint when i move to the page with goto() its working only on reloading or on navigation directly to the gantt page i get this Error
It may be a hint when i move to the page with goto() its working only on reloading or on navigation directly to the gantt page i get this Error
this is true for 4.0.7beta , on 4.0.8beta also goto() give me this error [plugin:vite:import-analysis] Failed to resolve entry for package "svelte-gantt". The package may have incorrect main/module/exports specified in its package.json. C:/./src/lib/components/xx/gantt/gant.svelte at packageEntryFailure (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:34841:11) at resolvePackageEntry (file:///C:/node_modules/vite/dist/node/chunks/dep-db16f19c.js:34838:5) at tryNodeResolve (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:34584:20) at Context.resolveId (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:34357:28) at async Object.resolveId (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:41039:32) at async TransformContext.resolve (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:40808:23) at async normalizeUrl (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:37589:34) at async TransformContext.transform (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:37728:47) at async Object.transform (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:41111:30) at async loadAndTransform (file:///C:/./node_modules/vite/dist/node/chunks/dep-db16f19c.js:37373:29 Click outside or fix the code to dismiss. You can also disable this overlay by setting server.hmr.overlay to false in vite.config.js.
It may be a hint when i move to the page with goto() its working only on reloading or on navigation directly to the gantt page i get this Error
also now (svelteKit .510) this is added to the error (node:11604) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
manage to solve by using import inside onMount
let SvelteGantt, SvelteGanttTable, MomentSvelteGanttDateAdapter; let data; onMount(async() => { SvelteGantt = (await import ('svelte-gantt')).SvelteGantt SvelteGanttTable = (await import ('svelte-gantt')).SvelteGanttTable MomentSvelteGanttDateAdapter = (await import ('svelte-gantt')).MomentSvelteGanttDateAdapter data = generate(); let options = {...} })
For the next guy passing by :laughing:
<script>
let SvelteGantt;
let SvelteGanttTable;
let MomentSvelteGanttDateAdapter;
let data;
onMount(async() => {
SvelteGantt = (await import ('svelte-gantt')).SvelteGantt
SvelteGanttTable = (await import ('svelte-gantt')).SvelteGanttTable
MomentSvelteGanttDateAdapter = (await import ('svelte-gantt')).MomentSvelteGanttDateAdapter
data = generate();
let options = {...} ;
})
</script>