Open bamthomas opened 11 months ago
Hey Bruno! Thanks for writing such a detailed repro, that's much appreciated.
It looks like Vite is generating invalid output. The correct output would be a star-import:
- import require$$0$4 from 'luxon';
+ import * as require$$0$4 from 'luxon';
I'm unsure why Vite is doing that, considering that cron-parser does var luxon = require('luxon')
, and not var luxon = require('luxon').default
, which would correctly lead to this default import.
I've dabbled around with your Vite config a bit, but couldn't find a fix - sorry. But I also don't think that Quirrel plays a role in this, my gut feeling is that you'll be able to reproduce this with cron-parser alone. This sounds more of a Vite bug to me.
Thank you @Skn0tt for your reply. We're still stuck on this.
What we tried:
So we don't understand what is blocking. What we have in the code (of the cronparser-sveltekit repo) is only:
import CronParser from "cron-parser"
import {DateTime} from "luxon"
And when I look at where cron-parser is imported in quirrel, I only see
src/shared/is-valid-cron.ts:import CronParser from "cron-parser";
src/shared/repeat.ts:import cronParser from "cron-parser";
So it seems OK. Do you have ideas?
Sorry, I don't have any ideas based on that. My advice is to look at the output that SvelteKit generates, and check if that's a valid ESM import for luxon (see my comment above). You should be able to find that output somewhere in your repository.
A workaround that we found to remove the blocker is to remove the dependency on luxon
. We added the types in dev dependencies:
"devDependencies": {
// ...
"@types/luxon": "^3.3.7",
// ...
}
That way we don't have any specific IDE setting (like importing luxon by default), the developer experience is OK and we use the transitive dependency of cron-parser
.
Still investigating on this (latest hypothesis is node-adapter module from sveltekit). We'll keep you posted here.
Just had the same issue. Any resolution here?
Bug Report
Current Behavior
When a sveltekit project is using quirrel and luxon, in module mode
type: "module"
then there is an error when using the built deliverable with:When we try to use quirrel there is the following exception:
See for example https://github.com/iroco-co/sveltekit-quirrel-esm
Everything was OK until I added luxon to the project.
Expected behavior/code
That there is no errors running quirrel. Note that there is maybe a typescript/es configuration to make the app working.
Environment
Possible Solution
It seems that the import from cron-parser :
is not compatible with ES6.
I began to try with another lib but there is probably a simpler configuration tweak.
Thank you for your comments or advice.