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

importing ?script from package doesn't work in dev, but works in build #924

Open
1 of 2 tasks
salmin89 opened this issue Oct 2, 2024 · 0 comments
Open
1 of 2 tasks

Comments

@salmin89
Copy link

salmin89 commented Oct 2, 2024

Build tool

Vite

Where do you see the problem?

  • In the browser
  • In the terminal

Describe the bug

when running in dev mode this code produces:

Error: Could not load javascript '' for script.

import scriptPath from '@scope/content/injected/myFeature?script';

console.log('path', scriptPath);
chrome.scripting
  .registerContentScripts([
    {
      id: 'myscript',
      js: [scriptPath],
      matches: ['<all_urls>'],
      runAt: 'document_start',
    },
  ])
  .then(() => {
    console.log('success reg');
  })
  .catch(console.error);

Reproduction

n/a

Logs

No response

System Info

System:
    OS: macOS 14.7
    CPU: (12) arm64 Apple M2 Pro
    Memory: 749.72 MB / 32.00 GB
    Shell: 5.9 - /bin/zsh
  Binaries:
    Node: 18.20.0 - ~/.nvm/versions/node/v18.20.0/bin/node
    Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.0/bin/yarn
    npm: 10.5.0 - ~/.nvm/versions/node/v18.20.0/bin/npm
    bun: 1.1.21 - /opt/homebrew/bin/bun
  Browsers:
    Brave Browser: 129.1.70.119
    Chrome: 129.0.6668.71
    Chrome Canary: 131.0.6750.0
    Edge: 129.0.2792.65
    Safari: 18.0

Severity

annoyance

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

No branches or pull requests

1 participant