ReferenceError: last_id is not defined
I am running timexexe in the Browser as a Typescript based Vue project and I am getting the following failure:
e-router.mjs:3451 ReferenceError: last_id is not defined
at node_modules/timexe/timexe.js (timexe.js:132:1)
at __require (chunk-J43GMYXM.js?v=afb89844:11:50)
at timexe.js:786:1
triggerError @ vue-router.mjs:3451
(anonymous) @ vue-router.mjs:3173
Promise.catch (async)
pushWithRedirect @ vue-router.mjs:3167
push @ vue-router.mjs:3099
install @ vue-router.mjs:3530
use @ runtime-core.esm-bundler.js:4390
main @ main.ts:21
await in main (async)
(anonymous) @ main.ts:25
----
vue-router.mjs:35 [Vue Router warn]: Unexpected error when starting the router: ReferenceError: last_id is not defined
at node_modules/timexe/timexe.js (timexe.js:132:1)
at __require (chunk-J43GMYXM.js?v=afb89844:11:50)
at timexe.js:786:1
We are using vite for packaging and this seems to related to simply importing the project:
import timexe from 'timexe'
Any ideas?
Hi Ajmas
Line 132 that triggered this warning, is a simple value assignment.
last_id=0;
The error that you get, is "ReferenceError: last_id is not defined"
Since line 132 isn't referencing the variable, but assigning it, I assume there is a discrepancy between your timexe.js and the one here on github?
Try downloading it again.
Best regards Simon
I just looked at the code, there is no var or let déclaration for this variable.
I created a sample Vue project, which makes use of Vite, and there may be other issues (adding the var wasn't enough):
https://github.com/ajmas/vue-timexe-sample
The timexe import is in src/components/HelloWorld.vue.
What I am observing is as soon as the import is in place the page fails to complete the render. Commenting it out allows it to render. It is possible the packaging of timexe needs to be updated?
You can see the behaviour on npm run dev.
It is very possible that the packaging needs updating. This package is very old. It was developed for javascript. You say you are using Typescript. Might it be stricter than pure javascript?
I don't have time to revise the code at this time. If you have a fix or would like to contribute, I would be happy to accept a pull request.
Best regards Simon
If I make changes, do you see yourself wanting to continue maintaining this project. I am just looking at this vs throwing efforts behind another project, such as cron-schedule.
I will do my best. But you should choose the package that suites you best. cron-schedule has a 1000 times bigger audience. This is already 10 years old, and could use a freshen-up. But you know how it is with time... I just hope you don't introduce new bugs, cus that takes a lot of time to address ;) Happy hacking