René's URL Explorer Experiment


Title: No apparent way to use `--bundle-dependencies=all` successfully since 1.5.0 · Issue #8616 · angular/angular-cli · GitHub

Open Graph Title: No apparent way to use `--bundle-dependencies=all` successfully since 1.5.0 · Issue #8616 · angular/angular-cli

X Title: No apparent way to use `--bundle-dependencies=all` successfully since 1.5.0 · Issue #8616 · angular/angular-cli

Description: Prior to the 1.5.0 release, it was possible to pass --bundle-dependencies=all --prod to get an AoT compiled self-contained bundle that worked for server-side rendering (SSR) under Node.js. Since 1.5.0, these flags produce a bundle that, ...

Open Graph Description: Prior to the 1.5.0 release, it was possible to pass --bundle-dependencies=all --prod to get an AoT compiled self-contained bundle that worked for server-side rendering (SSR) under Node.js. Since 1....

X Description: Prior to the 1.5.0 release, it was possible to pass --bundle-dependencies=all --prod to get an AoT compiled self-contained bundle that worked for server-side rendering (SSR) under Node.js. Since 1....

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

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"No apparent way to use `--bundle-dependencies=all` successfully since 1.5.0","articleBody":"Prior to the 1.5.0 release, it was possible to pass `--bundle-dependencies=all --prod` to get an AoT compiled self-contained bundle that worked for server-side rendering (SSR) under Node.js. Since 1.5.0, these flags produce a bundle that, as far as I can tell, can never work because they now rely on the existence of browser DOM APIs that don't exist in Node.\r\n\r\nIf there is any way to use `--bundle-dependencies=all` successfully in `--prod` build with 1.5.0+, I'd love to know about it.\r\n\r\n### Versions\r\n```\r\nAngular CLI: 1.5.4\r\nNode: 6.11.0\r\nOS: win32 x64\r\nAngular: 5.0.2\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... http, language-service, platform-browser\r\n... platform-browser-dynamic, platform-server, router\r\n\r\n@angular/cli: 1.5.4\r\n@angular-devkit/build-optimizer: 0.0.33\r\n@angular-devkit/core: 0.0.21\r\n@angular-devkit/schematics: 0.0.37\r\n@ngtools/json-schema: 1.1.0\r\n@ngtools/webpack: 1.8.4\r\n@schematics/angular: 0.1.7\r\ntypescript: 2.4.2\r\nwebpack: 3.8.1\r\n```\r\n\r\n### Repro steps\r\n\r\n* Clone the example repo at https://github.com/SteveSandersonMS/angular-bundledependencies-repro. This is the same as the universal-starter repo, except for [one commit](https://github.com/SteveSandersonMS/angular-bundledependencies-repro/commit/6104ae864b10e2a5d80c95ea836b596d0559c1f8) that gets as close as I can to a scenario where `--bundle-dependencies=all` could work (but still doesn't).\r\n* Run `npm install`\r\n* Observe that it works fine in a non-prod build by running `npm run build:ssr` then `npm run serve:ssr`. If you visit http://localhost:4000, you'll get both server and client rendering.\r\n* Observe that if you build in prod mode (run `npm run build:ssr:prod` then `npm run serve:ssr`), then it does **not** work - you'll get this error:\r\n\r\n```\r\nTypeError: StaticInjectorError[InjectionToken DocumentToken]: \r\n  StaticInjectorError[InjectionToken DocumentToken]: \r\n    Right-hand side of 'instanceof' is not an object\r\n    at ke (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:724114)\r\n    at xe (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:723991)\r\n    at lr (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:746752)\r\n    at _n.insertToken (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:767718)\r\n    at C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:726646\r\n    at Fe (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:726661)\r\n    at I (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:721959)\r\n    at Object.parse (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:766648)\r\n    at Object.t.createDocument (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:1194422)\r\n    at Object.t.createWindow (C:\\path\\angular-bundledependencies-repro\\dist\\server.js:4106:1194526)\r\n```\r\n\r\nIf you trace this into the `server.js` bundle code, what's happening is that it's testing whether `someValue instanceof HTMLElement` (though it's not obvious at first glance because everything is minified and renamed). That code would be OK in a browser, but it's an error in Node, because `HTMLElement` is `undefined`. So the generated bundle isn't going to work for SSR under Node.\r\n\r\n* If you want, verify that removing `--bundle-dependencies=all` from lines 22 and 23 in `package.json` is enough to make it work in both dev and prod builds. So the problem is the combination of `--prod` with `--bundle-dependencies=all` - you can use either on their own, but not both together.\r\n\r\n### Observed behavior\r\n\r\nFails with the `Right-hand side of 'instanceof' is not an object` error shown above.\r\n\r\n### Desired behavior\r\n\r\nSSR works as it did in the non-prod build.\r\n\r\n### Mention any other details that might be useful (optional)\r\n\r\nThe equivalent did work pre-1.5.0 (which was also Angular 4.x).\r\n\r\nThe reason I'm asking about this is because I'm building new Angular CLI-based ASP.NET templates that will be included in the .NET Core SDK and Visual Studio. We want the template to use `--bundle-dependencies=all` by default because then developers don't have to publish their `node_modules` to production, and attempting to publish 20,000+ files from `node_modules` is extremely time-consuming (and not always reliable) from VS. Plus it tends to hit Windows path-length limitations depending on the deployment target.","author":{"url":"https://github.com/SteveSandersonMS","@type":"Person","name":"SteveSandersonMS"},"datePublished":"2017-11-23T17:30:42.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":44},"url":"https://github.com/8616/angular-cli/issues/8616"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:465ad9ab-6502-2ed0-97c9-58315d1a690e
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-id9326:32D418:1907617:23473ED:698226C2
html-safe-nonce50901f66dbd7935c0f72b234b709cf1b29066b204982c8faaf2703c44e869146
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5MzI2OjMyRDQxODoxOTA3NjE3OjIzNDczRUQ6Njk4MjI2QzIiLCJ2aXNpdG9yX2lkIjoiMTYzMzgyNDA5ODI0NzM4NjgxOCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmac9b22370a70aafd7e128328040088554917b999e1d933709ba6b64459f405cb9d
hovercard-subject-tagissue:276442960
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/8616/issue_layout
twitter:imagehttps://opengraph.githubassets.com/f4c5b13d725232d811464737c7f8da886e94bed4c84ac41249ba5ef6f34f5dc1/angular/angular-cli/issues/8616
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/f4c5b13d725232d811464737c7f8da886e94bed4c84ac41249ba5ef6f34f5dc1/angular/angular-cli/issues/8616
og:image:altPrior to the 1.5.0 release, it was possible to pass --bundle-dependencies=all --prod to get an AoT compiled self-contained bundle that worked for server-side rendering (SSR) under Node.js. Since 1....
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernameSteveSandersonMS
hostnamegithub.com
expected-hostnamegithub.com
Nonef29b4256dc96a8de29f6e5fad4bf98fdbfc5cb1dbb313013053581f8470d8a21
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
release61292800a4f1180f0b13782adc5da7267ec99b94
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/angular/angular-cli/issues/8616#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F8616
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub SparkBuild and deploy intelligent appshttps://github.com/features/spark
GitHub ModelsManage and compare promptshttps://github.com/features/models
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
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
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
GitHub SponsorsFund open source developershttps://github.com/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/accelerator
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://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/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fangular%2Fangular-cli%2Fissues%2F8616
Sign up https://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/8616
Reloadhttps://github.com/angular/angular-cli/issues/8616
Reloadhttps://github.com/angular/angular-cli/issues/8616
angular https://github.com/angular
angular-clihttps://github.com/angular/angular-cli
Notifications https://github.com/login?return_to=%2Fangular%2Fangular-cli
Fork 11.9k https://github.com/login?return_to=%2Fangular%2Fangular-cli
Star 27k https://github.com/login?return_to=%2Fangular%2Fangular-cli
Code https://github.com/angular/angular-cli
Issues 262 https://github.com/angular/angular-cli/issues
Pull requests 22 https://github.com/angular/angular-cli/pulls
Actions https://github.com/angular/angular-cli/actions
Security 1 https://github.com/angular/angular-cli/security
Insights https://github.com/angular/angular-cli/pulse
Code https://github.com/angular/angular-cli
Issues https://github.com/angular/angular-cli/issues
Pull requests https://github.com/angular/angular-cli/pulls
Actions https://github.com/angular/angular-cli/actions
Security https://github.com/angular/angular-cli/security
Insights https://github.com/angular/angular-cli/pulse
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/8616
New issuehttps://github.com/login?return_to=https://github.com/angular/angular-cli/issues/8616
No apparent way to use --bundle-dependencies=all successfully since 1.5.0https://github.com/angular/angular-cli/issues/8616#top
https://github.com/vikerman
P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfulhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22P1%22
area: @angular-devkit/build-angularhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular-devkit%2Fbuild-angular%22
freq1: lowOnly reported by a handful of users who observe it rarelyhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
severity5: regressionhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22severity5%3A%20regression%22
needsTriagehttps://github.com/angular/angular-cli/milestone/11
https://github.com/SteveSandersonMS
https://github.com/SteveSandersonMS
SteveSandersonMShttps://github.com/SteveSandersonMS
on Nov 23, 2017https://github.com/angular/angular-cli/issues/8616#issue-276442960
https://github.com/SteveSandersonMS/angular-bundledependencies-reprohttps://github.com/SteveSandersonMS/angular-bundledependencies-repro
one commithttps://github.com/SteveSandersonMS/angular-bundledependencies-repro/commit/6104ae864b10e2a5d80c95ea836b596d0559c1f8
http://localhost:4000http://localhost:4000
vikermanhttps://github.com/vikerman
P1Impacts a large percentage of users; if a workaround exists it is partial or overly painfulhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22P1%22
area: @angular-devkit/build-angularhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22area%3A%20%40angular-devkit%2Fbuild-angular%22
freq1: lowOnly reported by a handful of users who observe it rarelyhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22freq1%3A%20low%22
severity5: regressionhttps://github.com/angular/angular-cli/issues?q=state%3Aopen%20label%3A%22severity5%3A%20regression%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.