-
Notifications
You must be signed in to change notification settings - Fork 182
Astro Support #306
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
this is the only way I made it work, but is because is making a call to github to download it wich is not performance friendly,
tried something like
or using as a module
and i had no luck. |
I had the same problem with Angular, the problem is that the bundlers of the Frameworks remove the unused imports, and the component depends on executing the The solution is to use the default export somewhere to force the bundler to include the component code. Example in Angular syntax: import RelativeTimeElement from '@github/relative-time-element'
@Component({
selector: 'my-component',
imports: [],
template: '<relative-time [attr.datetime]="myDate">April 1, 2024</relative-time>',
schemas: [ CUSTOM_ELEMENTS_SCHEMA ]
})
export class MyComponent {
myDate = new Date()
constructor() {
// Logs the default export to include the code...
console.log(RelativeTimeElement)
}
} |
I'm planning to use this on my astro project but the suggested implementation doesnt work, astro wont render any formated date at all.
Still getting the default April 1.
I dont see any way to import it into my server block or client. the tags relative-time are not doing anything.
Can you make it compatible so i can import it into my project like all the npm modules?
something like:
import { relative-time } from Relative-Time-Elements
The text was updated successfully, but these errors were encountered: