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
Document is not defined - Angular 17 #361
Comments
It is happening due to SSR. |
Hi @Rounaque-Noor ! Thank you for your message ! I don't understand your fix. This is my code, where I should insert your code ? new (TypeIt as any)("#typeIt", {
speed: 100,
loop: true
})
.type("Site-Web", {delay: 2000})
.delete(() => {
}, {delay: 1000, instant: false})
.type("App Mobile", {delay: 2000})
.delete(() => {
}, {delay: 1000})
.type("Cloud", {delay: 2000})
.delete(() => {
}, {delay: 1000})
.go(); Thank you. |
hi @BugProg ! |
Hi @GeronimoSerial ! |
Hi @GeronimoSerial, The code below seems to work without errors: import { isPlatformBrowser } from '@angular/common';
...
private isBrowser: boolean;
constructor(
@Inject(PLATFORM_ID) platformId: Object) {
this.isBrowser = isPlatformBrowser(platformId);
}
...
if (this.isBrowser) {
new (TypeIt as any)("#typeIt", {
speed: 100,
loop: true
})
.type("CCC", {delay: 2000})
.delete(() => {
}, {delay: 1000, instant: false})
.type("BBB", {delay: 2000})
.delete(() => {
}, {delay: 1000})
.type("AAA", {delay: 2000})
.delete(() => {
}, {delay: 1000})
.go();
} |
Hi !
I just updated my project to Angular 17, and I'm using modern compilation method with Vite.
I have an issue with TypeIt, I get the following error:
ERROR ReferenceError: document is not defined
during the compilation.NOTE
In spite of this error, the code seems to work perfectly in the browser.
The text was updated successfully, but these errors were encountered: