{
  "id": 1985801,
  "title": "Vite’s ?url Import Gives You a URL, Not jQuery",
  "url": "https://urgent.news/2026/08/19/vites-url-import-gives-you-a-url-not-jquery",
  "topic": "tech",
  "section": "Tech",
  "published": "2026-08-19T17:41:49.000Z",
  "source": {
    "name": "Dev.to",
    "slug": "dev-to",
    "url": "https://dev.to/kahwee/vites-url-import-gives-you-a-url-not-jquery-1dp4"
  },
  "original_language": "en",
  "account": "The source material explains the distinction between using a Vite import with the ?url suffix and a regular import without it. The key points are:\n\n1. Adding ?url to a Vite import changes the file's value from executable JavaScript to a URL string representing the asset. This URL can then be used as a dependency in the current module.\n\n2. When the imported value is used as a URL in a browser API like a script element or worklet loader, the file is treated as an asset. It may be hashed or inline as a data URL in production builds, but the stable contract is always receiving a URL string that the browser can use.\n\n3. Importing the URL does not execute the file in the current module. The file can still execute later if loaded through a browser API.\n\n4. The ?url import is useful in cases like loading a Paint Worklet or a script URL for an iframe. It provides the exact URL needed by the API.\n\n5. Do not use ?url for workers that import other modules. Vite should process the worker and its dependencies normally. Use the ?worker syntax instead.\n\nIn summary, the ?url import in Vite converts a file into a URL string that can be used as a dependency, but the file itself remains unexecuted in the importing module. It is useful for certain asset types but should not be used for general workers. The one rule to remember is that ?url means \"import the URL of this file, not the file itself\".",
  "summary": "The confusing part is only four characters long: ?url . Add it to a Vite import and the value changes from executable JavaScript to the address of an asset. import $ from ' jquery/dist/jquery.slim.js ' ; import jqueryUrl from ' jquery/dist/jquery.slim.js?url ' ; typeof $ ; // \"function\" typeof jqueryUrl ; // \"string\" Import Value in your code What happens at import time jquery.slim.js jQuery’s…",
  "key_points": [],
  "editors_take": null,
  "illustration": null,
  "coverage": {
    "outlets": 1,
    "also_reported_by": []
  },
  "ai_generated": true,
  "disclaimer": "Summaries, key points and the editor’s take are written by software from other outlets’ reporting and may contain errors — always check the linked original."
}