René's URL Explorer Experiment


Title: @angular/build: source-map comment scanner corrupts valid JS containing a regex literal · Issue #34590 · angular/angular-cli · GitHub

Open Graph Title: @angular/build: source-map comment scanner corrupts valid JS containing a regex literal · Issue #34590 · angular/angular-cli

X Title: @angular/build: source-map comment scanner corrupts valid JS containing a regex literal · Issue #34590 · angular/angular-cli

Description: Command serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was @angular/build 22.0.9 passes the isolated source-map removal test. @angular/cli remain...

Open Graph Description: Command serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was @angular/build 22.0.9 passes the isolated sour...

X Description: Command serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was @angular/build 22.0.9 passes the isolated sour...

Opengraph URL: https://github.com/angular/angular-cli/issues/34590

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@angular/build: source-map comment scanner corrupts valid JS containing a regex literal","articleBody":"### Command\n\nserve\n\n### Is this a regression?\n\n- [x] Yes, this behavior used to work in the previous version\n\n### The previous version in which this bug was not present was\n\n@angular/build 22.0.9 passes the isolated source-map removal test. @angular/cli remains at 22.2.4; Angular framework packages remain at 22.2.3.\n\n### Description\n\nWith @angular/build 22.2.4, ng serve fails when optimization and script\nsource maps are enabled. Vite reports invalid JavaScript during import\nanalysis. However, ng build succeeds, and the built application worked\nwhen served separately using a local static server.\n\nThe failure was traced to removeSourceMappingURL in @angular/build.\nThe development-server memory plugin calls this function before handing\ngenerated JavaScript to Vite when a source map is present.\n\nThe scanner appears to interpret a double quote inside a valid\nregular-expression literal as the beginning of a string. It then loses\ntrack of the actual string boundaries and removes a sourceMappingURL-like\nsequence that is string content, not a JavaScript comment.\n\nThis can be reproduced directly using the published build package,\nwithout application code, authentication libraries, or Vite itself.\n\nExpected:\nSource-map comment removal preserves valid JavaScript, including\nregular-expression literals and strings containing sourceMappingURL text.\n\nActual:\nValid JavaScript is truncated into invalid JavaScript. Vite subsequently\nreports the parsing error.\n\nThe desired behavior is to keep both optimization and script source maps\nenabled.\n\n### Minimal Reproduction\n\nWith `@angular/build@22.2.4` installed, save the following as `repro.cjs`\nand run:\n\n```sh\nnode repro.cjs\n```\n\nThis intentionally calls the internal utility to isolate the defect.\nIt is a standalone scanner reproduction, not a complete Angular app.\n\n```js\nconst assert = require('node:assert/strict');\nconst path = require('node:path');\nconst vm = require('node:vm');\n\nconst packageRoot = path.dirname(\n  require.resolve('@angular/build/package.json')\n);\n\nconst { removeSourceMappingURL } = require(\n  path.join(packageRoot, 'src', 'utils', 'source-map.js')\n);\n\nconst input =\n  'const pattern = /\"/; const text = \"//# sourceMappingURL=not-a-comment\";';\n\nnew vm.Script(input); // The input is valid JavaScript.\n\nconst output = removeSourceMappingURL(input);\nconsole.log(output);\n\nassert.equal(\n  output,\n  input,\n  'Input without an actual source-map comment should remain unchanged'\n);\n```\n\nExpected:\nThe assertion passes and the input is preserved unchanged.\n\nActual:\nThe assertion fails. The output is:\n\n```js\nconst pattern = /\"/; const text = \"\n```\n\nThe output is invalid JavaScript. The `sourceMappingURL` text was inside\na quoted string, not an actual comment.\n\n### Exception or Error\n\n```text\n[vite] Internal server error: Failed to parse source for import analysis\nbecause the content contains invalid JS syntax. If you are using JSX,\nmake sure to name the file with the .jsx or .tsx extension.\nPlugin: vite:import-analysis\n\nThe standalone reproduction fails its equality assertion.\nParsing the truncated output also produces:\nSyntaxError: Invalid or unexpected token\n```\n\n### Your Environment\n\n```text\nOriginal failing environment:\n@angular/build: 22.2.4\n@angular/cli: 22.2.4\n@angular/core: 22.2.3\n@angular/compiler: 22.2.3\n@angular/compiler-cli: 22.2.3\nTypeScript: 6.0.3\nVite: 8.3.0\nNode.js: 24.20.0\nOS: Windows\n\nCurrent version-pin configuration:\n@angular/build: 22.0.9\n@angular/cli: 22.2.4 — unchanged\nAngular core/compiler/compiler-cli: 22.2.3 — unchanged\nVite resolved by @angular/build: 7.3.6\n```\n\n### Anything else relevant?\n\n### Temporary workaround applied\n\nPinned `@angular/build` to exactly `22.0.9` instead of `22.2.4`:\n\n\"@angular/build\": \"22.0.9\"\n\nThis is the workaround currently used, not a fix to the scanner.\n\n- `@angular/cli` remains at `22.2.4` — it was not downgraded.\n- Angular core/compiler/compiler-cli remain at `22.2.3`.\n- Optimization and script source maps remain enabled.\n\nThe pinned build package uses Vite `7.3.6` instead of `8.3.0`.\nHowever, the minimal reproduction demonstrates the corruption directly\nin `@angular/build`'s source-map scanner without invoking Vite.\n\n\n### Related issue and fix\n\n- [Issue #33544 — Source-map comment removal corrupts JavaScript inside template literals](https://github.com/angular/angular-cli/issues/33544)\n- [PR #33545 — Prevent stripping nested sourceMappingURL comments](https://github.com/angular/angular-cli/pull/33545)\n\nThe earlier issue concerned source-map text inside template literals.\nIts fix introduced the replacement scanner. This report concerns\nregular-expression literal handling in that scanner.","author":{"url":"https://github.com/monyk99","@type":"Person","name":"monyk99"},"datePublished":"2026-10-29T14:01:32Z","url":"https://github.com/angular/angular-cli/issues/34590"}

react-profiling0
react-import-mapreact,react-dom,react-dom/client,react-dom/profiling,react-is,react/compiler-runtime,react/jsx-dev-runtime,react/jsx-runtime,scheduler@b8488ee2c322
route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:1fc1c37d-8541-3156-1ec6-c7c6d2f0c3e7
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idC8C6:29FFA9:11DCE03:16AE6E7:6B011A94
html-safe-nonce21b203455f59e9602ae3014d34a15dcd1b676d0e36170f57091002a52556ab24
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDOEM2OjI5RkZBOToxMURDRTAzOjE2QUU2RTc6NkIwMTFBOTQiLCJ2aXNpdG9yX2lkIjoiNDU1NDMxMDkzNTA5NDgyNzY2OSIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac691f6d14502a0e7f7dbf4355f37712583bf607cecc6e4b666679c9b8fb769dd9
hovercard-subject-tagissue:6101288920
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/34590/issue_layout
twitter:imagehttps://opengraph.githubassets.com/e36e33dc9929663a8d546f6de520f73d8878f2d23b63751cfdef8898315ccdbb/angular/angular-cli/issues/34590
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/e36e33dc9929663a8d546f6de520f73d8878f2d23b63751cfdef8898315ccdbb/angular/angular-cli/issues/34590
og:image:altCommand serve Is this a regression? Yes, this behavior used to work in the previous version The previous version in which this bug was not present was @angular/build 22.0.9 passes the isolated sour...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamemonyk99
hostnamegithub.com
expected-hostnamegithub.com
Nonecc5dfdd32f62ebd3223cab3af3aa2b268d3605218237326a48a99d1efd89495c
turbo-cache-controlno-preview
go-importgithub.com/angular/angular-cli git https://github.com/angular/angular-cli.git
octolytics-dimension-user_id139426
octolytics-dimension-user_loginangular
octolytics-dimension-repository_id36891867
octolytics-dimension-repository_nwoangular/angular-cli
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id36891867
octolytics-dimension-repository_network_root_nwoangular/angular-cli
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
release8c77c9e8439031ad54c75a250694842892f693e1
ui-targetcanary-2
theme-color#1e2327
color-schemelight dark
react-app-nameissues

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/34590#start-of-content
https://github.com/
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34590
GitHubRepository hosting, code review, and collaborationhttps://github.com/platform
CopilotAI coding agent for tasks, projects, and automated workhttps://github.com/features/copilot
ActionsCI/CD and automationhttps://github.com/features/actions
Code QualityQuality analysis, fixes, and enforcementhttps://github.com/features/code-quality
CodespacesCloud development environmentshttps://github.com/features/codespaces
Code SecurityVulnerability detection and remediationhttps://github.com/security/advanced-security/code-security
Secret ProtectionSecret scanning and leak preventionhttps://github.com/security/advanced-security/secret-protection
All Featureshttps://github.com/features
Documentationhttps://docs.github.com/en
Traininghttps://learn.github.com/skills
Certificationshttps://learn.github.com/credentials
Build with Copilothttps://github.com/features/ai
Customize Copilothttps://docs.github.com/en/copilot/how-tos/copilot-on-github/customize-copilot/customize-copilot-overview
Integrationshttps://github.com/marketplace
Trending reposhttps://github.com/trending
GitHub Sponsorshttps://github.com/open-source/sponsors
Developer articleshttps://github.com/resources/articles
ChangelogYour source for the latest features, improvements, and fixes across GitHub products, all in one place.https://github.blog/changelog/
Enterpriseshttps://github.com/enterprise
Teamhttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
See all industrieshttps://github.com/solutions/industry
Why GitHubhttps://github.com/why-github
Customer Storieshttps://github.com/customer-stories
Business insightshttps://github.com/solutions/executive-insights
Trust Centerhttps://github.com/trust-center
GitHub Advanced SecurityEnterprise-grade code securityhttps://github.com/security/advanced-security
Copilot for businessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Documentationhttps://docs.github.com/en
Resource centerhttps://github.com/resources
Bloghttps://github.blog/
Events & webinarshttps://github.com/resources/events
Community Forumhttps://github.com/orgs/community/discussions
Customer Storieshttps://github.com/customer-stories
Integrationshttps://github.com/marketplace
Customer supporthttps://help.github.com/
Traininghttps://learn.github.com/skills
GitHub Statushttps://www.githubstatus.com/
Abouthttps://github.com/about
Partnershttps://github.com/partners
Changeloghttps://github.blog/changelog/
GitHub UniverseThe event for developers, by developers — talks, workshops, and what’s next for GitHub.https://githubuniverse.com/
Pricinghttps://github.com/pricing
Sign inhttps://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F34590
Sign uphttps://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=angular%2Fangular-cli
Reloadhttps://github.com/angular/angular-cli/issues/34590
Reloadhttps://github.com/angular/angular-cli/issues/34590
Reloadhttps://github.com/angular/angular-cli/issues/34590
angularhttps://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Codehttps://github.com/angular/angular-cli
Issues198 (198)https://github.com/angular/angular-cli/issues
Pull requests23 (23)https://github.com/angular/angular-cli/pulls
Actionshttps://github.com/angular/angular-cli/actions
Security and quality8 (8)https://github.com/angular/angular-cli/security
Insightshttps://github.com/angular/angular-cli/insights
https://github.com/angular/angular-cli
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34590
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34590
@angular/build: source-map comment scanner corrupts valid JS containing a regex literalhttps://github.com/angular/angular-cli/issues/34590#top
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
needsTriagehttps://github.com/angular/angular-cli/milestone/11
https://github.com/monyk99
monyk99https://github.com/monyk99
on Oct 29, 2026https://github.com/angular/angular-cli/issues/34590#issue-6101288920
Issue #33544 — Source-map comment removal corrupts JavaScript inside template literalshttps://github.com/angular/angular-cli/issues/33544
PR #33545 — Prevent stripping nested sourceMappingURL commentshttps://github.com/angular/angular-cli/pull/33545
angular-robothttps://github.com/apps/angular-robot
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
on Oct 29, 2026https://github.com/angular/angular-cli/issues/34590#event-34593008918
angular-robothttps://github.com/apps/angular-robot
needsTriagehttps://github.com/angular/angular-cli/milestone/11
on Oct 29, 2026https://github.com/angular/angular-cli/issues/34590#event-34593012220
clydinhttps://github.com/clydin
on Oct 30, 2026https://github.com/angular/angular-cli/issues/34590#event-34719109068
fix(@angular/build): use oxc-parser fallback when stripping source-ma…https://github.com/clydin/angular-cli/commit/a2e3e697261b06c056dc1094f262fb6098452df1
https://docs.github.com/articles/closing-issues-via-commit-messages
a2e3e69https://github.com/clydin/angular-cli/commit/a2e3e697261b06c056dc1094f262fb6098452df1
fix(@angular/build): use oxc-parser fallback when stripping source-ma…https://github.com/clydin/angular-cli/commit/575c988150f1e2ffae26532fc71ea21aee2fe45f
https://docs.github.com/articles/closing-issues-via-commit-messages
575c988https://github.com/clydin/angular-cli/commit/575c988150f1e2ffae26532fc71ea21aee2fe45f
alan-agius4https://github.com/alan-agius4
on Nov 3, 2026https://github.com/angular/angular-cli/issues/34590#event-35048298661
fix(@angular/build): use oxc-parser fallback when stripping source-ma…https://github.com/angular/angular-cli/commit/631ac8aa66669875af156bde9534a756ae915d79
https://docs.github.com/articles/closing-issues-via-commit-messages
631ac8ahttps://github.com/angular/angular-cli/commit/631ac8aa66669875af156bde9534a756ae915d79
alan-agius4https://github.com/alan-agius4
completedhttps://github.com/angular/angular-cli/issues?q=is%3Aissue%20state%3Aclosed%20archived%3Afalse%20reason%3Acompleted
on Nov 3, 2026https://github.com/angular/angular-cli/issues/34590#event-35048299664
alan-agius4https://github.com/alan-agius4
on Nov 3, 2026https://github.com/angular/angular-cli/issues/34590#event-35048301821
fix(@angular/build): use oxc-parser fallback when stripping source-ma…https://github.com/angular/angular-cli/commit/8984b4a0ee1ce1e265393233407a6409825bcdfa
https://docs.github.com/articles/closing-issues-via-commit-messages
8984b4ahttps://github.com/angular/angular-cli/commit/8984b4a0ee1ce1e265393233407a6409825bcdfa
Sign up for freehttps://github.com/signup?return_to=https://github.com/angular/angular-cli/issues/34590
Sign in to commenthttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/34590
area: @angular/buildhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular%2Fbuild%22
needsTriageNo due datehttps://github.com/angular/angular-cli/milestone/11
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.