Title: @angular/localize loadTranslations can only be default-imported using the 'allowSyntheticDefaultImports' flag. · Issue #45179 · angular/angular · GitHub
Open Graph Title: @angular/localize loadTranslations can only be default-imported using the 'allowSyntheticDefaultImports' flag. · Issue #45179 · angular/angular
X Title: @angular/localize loadTranslations can only be default-imported using the 'allowSyntheticDefaultImports' flag. · Issue #45179 · angular/angular
Description: Which @angular/* package(s) are the source of the bug? localize Is this a regression? Yes Description When an app imports loadTranslations() from @angular/localize in v13.x.x this throws an error when running ng build. During testing I n...
Open Graph Description: Which @angular/* package(s) are the source of the bug? localize Is this a regression? Yes Description When an app imports loadTranslations() from @angular/localize in v13.x.x this throws an error w...
X Description: Which @angular/* package(s) are the source of the bug? localize Is this a regression? Yes Description When an app imports loadTranslations() from @angular/localize in v13.x.x this throws an error w...
Opengraph URL: https://github.com/angular/angular/issues/45179
X: @github
Domain: github.com
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"@angular/localize loadTranslations can only be default-imported using the 'allowSyntheticDefaultImports' flag.","articleBody":"### Which @angular/* package(s) are the source of the bug?\n\nlocalize\n\n### Is this a regression?\n\nYes\n\n### Description\n\nWhen an app imports `loadTranslations()` from `@angular/localize` in v13.x.x this throws an error when running `ng build`.\r\n\r\nDuring testing I narrowed this down to `import { loadTranslations } from '@angular/localize';`. This only happens on v13.x.x of @angular packages.\r\n\r\nSteps to reproduce:\r\n1. Create a new project using `ng new`\r\n2. Confirm that the project can be build `ng build`\r\n3. Install @angular/localize `npm install @angular/localize`\r\n4. Import `loadTranslations` in `main.ts` (don't have to call it just importing will be enough)\r\n5. Run `ng build` again, the build will error\r\n\r\nAdding `allowSyntheticDefaultImports` to tsconfig fixes the error but unsure if this is recommended or not.\n\n### Please provide a link to a minimal reproduction of the bug\n\n_No response_\n\n### Please provide the exception or error you saw\n\n```true\n~/C/b/angular-13-2 (main *) ng build\r\n✔ Browser application bundle generation complete.\r\n\r\nError: node_modules/@angular/compiler-cli/src/ngtsc/file_system/src/compiler_host.d.ts:9:8 - error TS1259: Module '\"/Users/robertrhoades/Code/bmj/angular-13-2/node_modules/typescript/lib/typescript\"' can only be default-imported using the 'allowSyntheticDefaultImports' flag\r\n\r\n9 import ts from 'typescript';\r\n ~~\r\n\r\n node_modules/typescript/lib/typescript.d.ts:7594:1\r\n 7594 export = ts;\r\n ~~~~~~~~~~~~\r\n This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.\r\n\r\n\r\nError: node_modules/@angular/compiler-cli/src/ngtsc/file_system/src/logical.d.ts:9:8 - error TS1259: Module '\"/Users/robertrhoades/Code/bmj/angular-13-2/node_modules/typescript/lib/typescript\"' can only be default-imported using the 'allowSyntheticDefaultImports' flag\r\n\r\n9 import ts from 'typescript';\r\n ~~\r\n\r\n node_modules/typescript/lib/typescript.d.ts:7594:1\r\n 7594 export = ts;\r\n ~~~~~~~~~~~~\r\n This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.\r\n\r\n\r\nError: node_modules/@angular/compiler-cli/src/ngtsc/file_system/src/util.d.ts:9:8 - error TS1259: Module '\"/Users/robertrhoades/Code/bmj/angular-13-2/node_modules/typescript/lib/typescript\"' can only be default-imported using the 'allowSyntheticDefaultImports' flag\r\n\r\n9 import ts from 'typescript';\r\n ~~\r\n\r\n node_modules/typescript/lib/typescript.d.ts:7594:1\r\n 7594 export = ts;\r\n ~~~~~~~~~~~~\r\n This module is declared with using 'export =', and can only be used with a default import when using the 'allowSyntheticDefaultImports' flag.\n```\n\n\n### Please provide the environment you discovered this bug in (run `ng version`)\n\n```true\n_ _ ____ _ ___\r\n / \\ _ __ __ _ _ _| | __ _ _ __ / ___| | |_ _|\r\n / △ \\ | '_ \\ / _` | | | | |/ _` | '__| | | | | | |\r\n / ___ \\| | | | (_| | |_| | | (_| | | | |___| |___ | |\r\n /_/ \\_\\_| |_|\\__, |\\__,_|_|\\__,_|_| \\____|_____|___|\r\n |___/\r\n \r\n\r\nAngular CLI: 13.2.4\r\nNode: 14.18.1\r\nPackage Manager: npm 6.14.15\r\nOS: darwin x64\r\n\r\nAngular: 13.2.3\r\n... animations, common, compiler, compiler-cli, core, forms\r\n... localize, platform-browser, platform-browser-dynamic, router\r\n\r\nPackage Version\r\n---------------------------------------------------------\r\n@angular-devkit/architect 0.1302.4\r\n@angular-devkit/build-angular 13.2.4\r\n@angular-devkit/core 13.2.4\r\n@angular-devkit/schematics 13.2.4\r\n@angular/cli 13.2.4\r\n@schematics/angular 13.2.4\r\nrxjs 7.5.4\r\ntypescript 4.5.5\n```\n\n\n### Anything else?\n\nConfirmed this by making a new angular 13 project and also upgrading a new angular 12 project to 13. In both cases same result. Commenting out the loadTranslations import resolves the issue.","author":{"url":"https://github.com/studioromeo","@type":"Person","name":"studioromeo"},"datePublished":"2022-02-23T17:15:46Z","url":"https://github.com/angular/angular/issues/45179"}
| 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:fcb66208-60c9-27e9-7930-54f1a1a117c7 |
| current-catalog-service-hash | 81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114 |
| request-id | 89BC:2463BD:F80028:13F145B:6B00FFAA |
| html-safe-nonce | 959d795262eec9fa72db4f43c1e4486b60b5993459832f797954dcc294b08c1f |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI4OUJDOjI0NjNCRDpGODAwMjg6MTNGMTQ1Qjo2QjAwRkZBQSIsInZpc2l0b3JfaWQiOiI2NzY2NDk0ODYyNzcyMTQxMjIiLCJyZWdpb25fZWRnZSI6ImlhZCIsInJlZ2lvbl9yZW5kZXIiOiJpYWQifQ== |
| visitor-hmac | 5d3a4e858535e3d7e37945702b27c43794e194a26e226f20d57014ce587d01fb |
| hovercard-subject-tag | issue:1148362151 |
| 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/45179/issue_layout |
| twitter:image | https://opengraph.githubassets.com/df7910a8b6989ab33d292ed58ae8bdbed537388e98cb652dab2dd5747b9de825/angular/angular/issues/45179 |
| twitter:card | summary_large_image |
| og:image | https://opengraph.githubassets.com/df7910a8b6989ab33d292ed58ae8bdbed537388e98cb652dab2dd5747b9de825/angular/angular/issues/45179 |
| og:image:alt | Which @angular/* package(s) are the source of the bug? localize Is this a regression? Yes Description When an app imports loadTranslations() from @angular/localize in v13.x.x this throws an error w... |
| og:image:width | 1200 |
| og:image:height | 600 |
| og:site_name | GitHub |
| og:type | object |
| og:author:username | studioromeo |
| hostname | github.com |
| expected-hostname | github.com |
| None | cb7fa109eca7d4156c889f474306b0e91336055e9adf8fd4684b61e49094d124 |
| turbo-cache-control | no-preview |
| go-import | github.com/angular/angular git https://github.com/angular/angular.git |
| octolytics-dimension-user_id | 139426 |
| octolytics-dimension-user_login | angular |
| octolytics-dimension-repository_id | 24195339 |
| octolytics-dimension-repository_nwo | angular/angular |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 24195339 |
| octolytics-dimension-repository_network_root_nwo | angular/angular |
| 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 | 2b59d31a4e44f08b7af67a4b67f8fd0af3befe2a |
| ui-target | full |
| theme-color | #1e2327 |
| color-scheme | light dark |
| react-app-name | issues |
Links:
Viewport: width=device-width