Skip to content

fix(injectScript): wait for the script to load #1768

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

JianJroh
Copy link

Case

// content.ts
export default defineContentScript({
  async main() {
    await injectScript('/injected.js')
    console.log('content script started')
  },
})
// injected.ts
export default defineUnlistedScript({
  main() {
    console.log('injected script started')
  },
})

Result

Before change

content script started
injected script started

After change

injected script started
content script started

Ensure that the code runs in the expected order.

Copy link

netlify bot commented Jun 23, 2025

Deploy Preview for creative-fairy-df92c4 ready!

Name Link
🔨 Latest commit 83be7de
🔍 Latest deploy log https://app.netlify.com/projects/creative-fairy-df92c4/deploys/6858d1bdd05a5300086e1804
😎 Deploy Preview https://deploy-preview-1768--creative-fairy-df92c4.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

1 participant