Comments (18)
Thank you very much @metonym for your time and effort.
from svelte-time.
thanks @metonym !
To be honest I am not using this component anymore, so I'm not sure what to do with this issue! :) Should I close it, from what I can read I looks like it is fixed now, right?
from svelte-time.
@kbsali Thank you for raising this issue.
What SvelteKit version are you using? What adapter?
The SvelteKit example uses the latest SvelteKit version with the Node adapter and is able to build successfully.
from svelte-time.
$ npm list| grep svelte
├── @sveltejs/[email protected]
├── @sveltejs/[email protected]
...
├── [email protected]
So it's with the Vercel adapter. In the end I only started using your component and so it was not too long to implement my own component based on Intl.DateTimeFormat
and Intl.RelativeTimeFormat
, making the build work fine. I'd still be interested in getting svelte-time to work, but apparently dayjs
' maintainer is not really reactive at updating his lib :/
from svelte-time.
@kbsali Thank you for the details.
I swapped the Node adapter for the Vercel adapter and it still built successfully.
However, I was able to repro the error by installing dayjs
as a devDependency
. I believe the solution is to not explicitly install dayjs
as its own dependency.
Related: #3 (comment)
from svelte-time.
There's still an issue with Vite (essentially a restart of the dev-server required for every change), which dayjs v2 should fix, but they're in alpha and haven't ported relativeTime
plugin yet.
from svelte-time.
@imbolc Thanks for the info. I'm now encountering a different issue in dev for SvelteKit, and a build error when using Snowpack. I didn't encounter this when linking it locally.
I think I'll have to revert #13.
from svelte-time.
It looks like dayjs
v2 is still a work in progress; although it's written in ESM, it does not have the relativeTime
plugin.
An alternative would be to fork dayjs
and make it compatible.
from svelte-time.
If everything else except of relativeTime
works with dayjs-v2
we could create a next
branch depending on it. With regard to relativeTime
we could help them to port the plugin or remove relative
prop and wait until they port the plugin themselves.
from svelte-time.
And today, I'm also facing the same issue using VITE
I'm using static adapter because I'm using it with capacitorJS for mobile development
from svelte-time.
I'm also facing the same issue trying with a 'yup' module, using the node adapter.
from svelte-time.
Same issue here, Netlify build failure with error Error [ERR_UNSUPPORTED_DIR_IMPORT]: Directory import '/opt/build/repo/node_modules/dayjs/esm' is not supported resolving ES modules imported from /opt/build/repo/.svelte-kit/output/server/entries/pages/obavijesti.svelte.js 9:35:57 AM: Did you mean to import dayjs/esm/index.js?
from svelte-time.
Update: I published v0.7.1 which switches the dayjs
imports back to CJS from ESM.
This should unblock usage of this library with SvelteKit.
The current downside is that it doesn't work with Snowpack, which I've recorded as a known issue. However, I feel that it's better to unblock SvelteKit than Snowpack since SvelteKit/vite has ~30x the usage of Snowpack (based on average NPM downloads).
from svelte-time.
I just tried out this plugin using the instructions here on this repo:
npm i -D svelte-time
<script>
import Time from "svelte-time";
</script>
<Time />
and get an import not found: default
.
Might this be related to the use of typescript or did I run into the issue here?
from svelte-time.
@Giszmo What set-up are you using?
from svelte-time.
node v18.6.0
typescript ^4.7.4
... what part of set-up do you mean? It was for https://github.com/Giszmo/nostroid
from svelte-time.
what part of set-up do you mean?
By set-up, I'm referring to SvelteKit/Vite/Rollup etc.
It looks like you're using SvelteKit. From a glance, it looks correct. Are you able to run the SvelteKit example locally?
from svelte-time.
Everything works totally fine until I try to add svelte-time. The import runs into issues.
If you want me to debug something, I'm around but else, I wrote my own widget that's good enough for now.
from svelte-time.
Related Issues (19)
- Switching format after an amount of time HOT 1
- Relative mode title format HOT 5
- Locale options? HOT 1
- As great as this plugin is, dayjs is blocking the way HOT 1
- `svelte-time` version 0.7.1 doesn't work with Snowpack HOT 7
- export error relativeTime HOT 2
- Different with the actual data
- Cannot read properties of undefined (reading '$i') HOT 7
- Cannot import Time with updated SvelteKit HOT 1
- Uncaught SyntaxError: ambiguous indirect export: default HOT 5
- Suggestion: Use a single global readable store for live updates HOT 4
- Error code 500: Cannot use import statement outside a module HOT 5
- How do I load multiple locales and update the <Time> using $locale? HOT 1
- Can't get relative time with locale HOT 1
- WARNING: The following packages have a svelte field in their package.json but no exports condition for svelte. HOT 8
- Package will break in future Svelte versions HOT 1
- How to use this inside <title> HOT 2
- How to NOT render the title global attribute. HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from svelte-time.