Title: Proposal: Provide a way to add externals to webpack config · Issue #2141 · angular/angular-cli · GitHub
Open Graph Title: Proposal: Provide a way to add externals to webpack config · Issue #2141 · angular/angular-cli
X Title: Proposal: Provide a way to add externals to webpack config · Issue #2141 · angular/angular-cli
Description: The issue is that if I use global script via app[0].scripts I cannot use it again in my .ts files. Example: if I have: "scripts": [ "../node_modules/jquery/dist/jquery.js", "../node_modules/moment/moment.js", "../node_modules/fullcalenda...
Open Graph Description: The issue is that if I use global script via app[0].scripts I cannot use it again in my .ts files. Example: if I have: "scripts": [ "../node_modules/jquery/dist/jquery.js", "../node_modules/moment/...
X Description: The issue is that if I use global script via app[0].scripts I cannot use it again in my .ts files. Example: if I have: "scripts": [ "../node_modules/jquery/dist/jquery.js", &quo...
Opengraph URL: https://github.com/angular/angular-cli/issues/2141
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"Proposal: Provide a way to add externals to webpack config","articleBody":"The issue is that if I use global script via app[0].scripts I cannot use it again in my .ts files.\n\nExample: if I have:\n\n```\n \"scripts\": [\n \"../node_modules/jquery/dist/jquery.js\",\n \"../node_modules/moment/moment.js\",\n \"../node_modules/fullcalendar/dist/fullcalendar.min.js\"\n ],\n```\n\nI cannot do: `import * as moment from 'moment';`. If I do so, moment will become an empty object. Of course, I can use it without importing it since it is global BUT other libs that depends on moment (angular2-moment in my case) will do `import * as moment from 'moment';`, they will get an empty object and their code will break. \nThen I cannot use this libs. (I think https://github.com/angular/angular-cli/issues/1974 is related)\n\nI cannot remove moment from scripts since I have other global scripts that depend on it (fullcalendar). Maybe there is a way to make all this scripts work without apps[0].scripts but I have not found it.\n\nMy solution is to use webpack externals https://webpack.github.io/docs/library-and-externals.html\n\nIf I add \n\n```\nexternals: {\n 'moment': 'moment'\n },\n```\n\nto `webpack-build-common.ts` it is working.\n\nI can provide a PR adding externals from `apps[0].externals` to the webpack config. Is it the right solution? \n","author":{"url":"https://github.com/MrChoclate","@type":"Person","name":"MrChoclate"},"datePublished":"2016-09-15T16:51:47Z","url":"https://github.com/angular/angular-cli/issues/2141"}
| react-profiling | 0 |
| react-import-map | react,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-controller | voltron_issues_fragments |
| route-action | issue_layout |
| fetch-nonce | v2:1a40f10e-bbd3-cf66-be65-e31439a4b956 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | C024:21DFED:967341:BE3F77:6B021BA3 |
| html-safe-nonce | 8a22a0fc9e86d75fdc461a4bf86a61b2aea3d815f9f1f2b34727aeb6b4a2c25f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJDMDI0OjIxREZFRDo5NjczNDE6QkUzRjc3OjZCMDIxQkEzIiwidmlzaXRvcl9pZCI6IjY4Nzc3NDg4MzE4ODc0MzI2MTEiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | edf3bbfee68c60a3c6dc60b948f88a41b9f5ce140827823aa82966daaf628735 |
| hovercard-subject-tag | issue:177229337 |
| github-keyboard-shortcuts | repository,issues,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/angular/angular-cli/2141/issue_layout |
| twitter:image | https://opengraph.githubassets.com/4c84bce5edede6dd6afa4df5a5d8fcaaabdb1b268a48b991f9aa7d6a6486a8c1/angular/angular-cli/issues/2141 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/4c84bce5edede6dd6afa4df5a5d8fcaaabdb1b268a48b991f9aa7d6a6486a8c1/angular/angular-cli/issues/2141 |
| og:image:alt | The issue is that if I use global script via app[0].scripts I cannot use it again in my .ts files. Example: if I have: "scripts": [ "../node_modules/jquery/dist/jquery.js", "../node_modules/moment/... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | MrChoclate |
| hostname | github.com |
| expected-hostname | github.com |
| None | 87e774ee7c6b3bee0490394e4d3e57ec9dbc956f74b87ea685dc8996c1676456 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular-cli git https://github.com/angular/angular-cli.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 36891867 |
| octolytics-dimension-repository_nwo | angular/angular-cli |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 36891867 |
| octolytics-dimension-repository_network_root_nwo | angular/angular-cli |
| turbo-body-classes | logged-out env-production page-responsive |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 423dbb54c5e7bfecc838eb387c1435eb3d0e760d |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width