Skip to content

Stop the Autoloader from requesting file: URLs in bundled apps - #4171

Merged
DmitrySharabin merged 1 commit into
v2from
autoloader-bundled-path
Oct 15, 2026
Merged

DmitrySharabin merged 1 commit into
v2from
autoloader-bundled-path

Conversation

@DmitrySharabin

Copy link
Copy Markdown
Member

Fall back to ./ when import.meta.url is a file: URL on a web page, and name srcPath in the load error.

webpack, Rspack and Parcel replace import.meta.url with the module's path on the build machine. The Autoloader's default path then pointed there. An Autoloader page bundled from v2, in Chromium:

Before After
webpack 5.111, Rspack 2.2 file:///…/node_modules/prismjs/dist/languages/css.js: "Not allowed to load local resource" languages/css.js next to the bundle
Parcel 2.16 file:///node_modules/prismjs/dist/languages/css.js: same error languages/css.js next to the bundle
Rollup, Rolldown, esbuild, Bun, Vite languages/css.js next to the bundle Unchanged
  • With dist/languages copied next to the bundle, all eight bundlers load the grammar with no extra settings. The README says so for bundled apps.
  • Loading dist/ straight from a server or CDN still finds dist/languages/.
  • With esbuild --bundle (IIFE output), import.meta becomes {}. The guard uses ?., so the Autoloader still starts there.
  • The issue's repro calls loadLanguages(), which never uses the Autoloader's path. The defect is in the Autoloader's default srcPath.

Closes #4166

🤖 Generated with Claude Code

Closes #4166

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@netlify

netlify Bot commented Oct 15, 2026 •

Copy link
Copy Markdown

✅ Deploy Preview for dev-prismjs-com ready!

Name Link
🔨 Latest commit 1901af7
🔍 Latest deploy log https://app.netlify.com/projects/dev-prismjs-com/deploys/6ad0c26780e86b2f2d0e2e5e
😎 Deploy Preview https://deploy-preview-4171--dev-prismjs-com.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.
🤖 Make changes Run an agent on this branch

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

@DmitrySharabin
DmitrySharabin merged commit b80fcd0 into v2 Oct 15, 2026
12 checks passed
@DmitrySharabin
DmitrySharabin deleted the autoloader-bundled-path branch October 15, 2026 12:10
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.

Autoloader's default path is a file:// URL from the build machine under webpack

1 participant