Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ng xi18n doesn't report typescript errors #8065

Closed
ocombe opened this issue Oct 16, 2017 · 3 comments · Fixed by #8480
Closed

ng xi18n doesn't report typescript errors #8065

ocombe opened this issue Oct 16, 2017 · 3 comments · Fixed by #8480
Assignees
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix

Comments

@ocombe
Copy link
Contributor

ocombe commented Oct 16, 2017

Bug Report or Feature Request (mark with an x)

- [x] bug report

Versions.

Angular CLI: 1.5.0-rc.0 (e)
Node: 6.9.5
OS: win32 x64
Angular: 5.0.0-rc.2
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.5.0-rc.0
@angular-devkit/build-optimizer: 0.0.27
@angular-devkit/core: 0.0.20
@angular-devkit/schematics: 0.0.33
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.8.0-rc.0
@schematics/angular: 0.0.45
typescript: 2.3.3
webpack-concat-plugin: 1.4.0
webpack-dev-server: 2.7.1
webpack: 3.7.1

Repro steps.

Create a new app with the cli 1.5.0-rc.0 but skip install. Update Angular dependencies to 5.0.0-rc.2, but don't update typescript (keep ~2.3.3).
Update your component to add a i18n attribute on some text. For example: <h1 i18n>Welcome to {{title}}!</h1>.
Add the following command to your package.json file: "extract": "ng xi18n -f xlf -l en --of messages.xlf -op src/i18n" and start it with npm run extract.
The app is compiled and... nothing happens. The translations are not extracted.

The log given by the failure.

There is no log and that is the problem. The actual error is:

Error: The Angular Compiler requires TypeScript >= 2.4.\n    at new AngularCompilerProgram (C:\\www\\i18n-no-cli\\node_modules\\@angular\\compiler-cli\\src\\transformers\\program.js:61:19)\n    at Object.exports.createProgram (C:\\www\\i18n-no-cli\\node_modules\\@angular\\compiler-cli\\src\\transformers\\program.js:650:12)\n    at Object.createProgram (C:\\www\\i18n-no-cli\\node_modules\\@angular\\compiler-cli\\src\\ngtools_api2.js:27:22)\n    at AngularCompilerPlugin._createOrUpdateProgram (C:\\www\\i18n-no-cli\\node_modules\\@ngtools\\webpack\\src\\angular_compiler_plugin.js:234:43)\n    at _donePromise.Promise.resolve.then.then (C:\\www\\i18n-no-cli\\node_modules\\@ngtools\\webpack\\src\\angular_compiler_plugin.js:459:29)

But it is not reported. If you go to this line:

const callback: webpack.compiler.CompilerCallback = (err, stats) => {
then you can see that err is null, but if you log the stats object you will see the errors.
Also the .catch method line 53 is called but err is undefined so nothing happens (I'm not sure if it is related).

Desired functionality.

It should log the error to the console and fail the extraction instead of looking like everything worked.

@filipesilva filipesilva self-assigned this Oct 16, 2017
@filipesilva filipesilva added P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix labels Oct 16, 2017
@intellix
Copy link
Contributor

intellix commented Nov 6, 2017

This one is quite painful for me :) Both serve and builds work, but for some reason xi18n doesn't output any errors or files and I had no idea why.

In the end, it seemed to be caused by this which used to be reported:

<div i18n>
  <span i18n>Something</span>
</div>

@ocombe
Copy link
Contributor Author

ocombe commented Nov 6, 2017

I thought that you had fixed that one @filipesilva ?

ocombe added a commit to ocombe/angular-cli that referenced this issue Nov 14, 2017
ocombe added a commit to ocombe/angular-cli that referenced this issue Nov 14, 2017
ocombe added a commit to ocombe/angular-cli that referenced this issue Nov 14, 2017
ocombe added a commit to ocombe/angular-cli that referenced this issue Nov 14, 2017
ocombe added a commit to ocombe/angular-cli that referenced this issue Nov 20, 2017
hansl pushed a commit that referenced this issue Nov 20, 2017
hansl pushed a commit that referenced this issue Nov 23, 2017
dond2clouds pushed a commit to d2clouds/speedray-cli that referenced this issue Apr 23, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants