Skip to content
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

fix: remove links preload script at init mode when using Nuxt SSG #36

Merged
merged 1 commit into from
Sep 17, 2023

Conversation

hieu-ht
Copy link
Contributor

@hieu-ht hieu-ht commented Sep 17, 2023

Description

I am using this awesome library with Nuxt in SSG mode. It works very well when using the 'mount' mode, but I noticed that it doesn't delay all scripts from loading when using the 'init' mode. When I dug deeper into the source code, I discovered that in 'init' mode, the library removes script tags from the body. However, when I use Nuxt in SSG mode, those js script are placed inside the head tag using a link tag like this:

<link rel="modulepreload" as="script" crossorigin href="/_nuxt/entry.81e73eaf.js">

Therefore, I created this PR to remove those link tags containing JS scripts as mentioned above, to ensure that the 'init' mode functions correctly in Nuxt SSG mode.
I have limited experience contributing to open-source projects and I hope to receive feedback and suggestions from everyone. I also hope that my PR will be merged to help others.

Linked Issues

Additional context

@harlan-zw
Copy link
Owner

Good catch, thanks!

@harlan-zw harlan-zw merged commit d0a4909 into harlan-zw:main Sep 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants