question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Reopen: ng-xi18n tool compiles TypeScript files

See original GitHub issue

Sorry that I must reopen issue #12305 in this way. But @vicb closed the issue although it has never been fixed. I asked @vicb multiple times (here and in gitter) to reopen the issue but he never responded…

I’m submitting a …

[x] bug report

Current behavior Having a Webpack 2 project (https://angular.io/docs/ts/latest/guide/webpack.html -> no Angular CLI) and running the ng-xi18n tool will compile all TypeScript files. The result is a src directory full with .js, .js.map and .metadata.json files.

Expected behavior The ng-xi18n tool should only generate the messages file.

What is the motivation / use case for changing the behavior? A src directory without .js, .js.map and .metadata.json files.

Please tell us about your environment: Linux

  • Angular version: 2.3.1
  • Browser: All
  • Language: TypeScript 2.0.10
  • Node (for AoT issues): 6.9.2

Current workaround:

"prei18n": "rimraf ./temp && shx mv ./tsconfig.json ./tsconfig.bak.json && shx mv ./tsconfig.i18n.json ./tsconfig.json",
"i18n": "ng-xi18n && shx mv ./messages.xlf ./src/app/locale",
"posti18n": "shx mv ./tsconfig.json ./tsconfig.i18n.json && shx mv ./tsconfig.bak.json ./tsconfig.json && rimraf ./temp"

tsconfig.i18n.json contains "outDir": "temp",.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:2
  • Comments:14 (8 by maintainers)

github_iconTop GitHub Comments

4reactions
vicbcommented, Dec 20, 2016

The issue here is that we call tsc.main() in the extract_i18n.ts - we should actually have a stripped down version of this function copied over to extract_18n.ts and remove the emit part.

3reactions
Martin-Luftcommented, Dec 21, 2016

@vicb what are talking about? In the angular2-seed project you see the outDir property in the tsconfig.json file. This was mentioned in #12305.

Your example shows the problem!

npm run build and you will see main.bundle.js and main.map in the dist directory. This is the webpack2 result.

./node_modules/.bin/ng-xi18n and you will see a src directory with .js, .js.map and .metadata.json files in the dist direcory. This is not the webpack2 result you want and this files are also not part of the webpack2 result!

In a webpack2 project you should not set the outDir property in the tsconfig.json file (https://angular.io/docs/ts/latest/guide/webpack.html). So remove this property and then your src directory will be full with .js, .js.map and .metadata.json files.

So please reopen #12305 or this issue, thanks!

Read more comments on GitHub >

github_iconTop Results From Across the Web

TypeScript tool window | WebStorm Documentation - JetBrains
The TypeScript tool window lists compilation errors in TypeScript code. ... By default, Compile All stands for Compile all TypeScript files ...
Read more >
I18N Compilation Failed With Sass - Resource File Not Found
Upgrade Angular CLI globally. First check your current Angular CLI version by running command. Note that if you run this command inside Angular ......
Read more >
ngx-i18n-combine - npm
Merge i18n files from components and merge to common locale files. Latest version: 1.2.0, last published: a year ago.
Read more >
Zowe Documentation - Zowe Docs
Zowe™ is an open source software framework that allows mainframe development and operation teams to securely manage, control, script, and develop on the ......
Read more >
Typescript compile to single file - javascript - Stack Overflow
Probably, the best option is to use a module bundler / build tool, like Webpack. Webpack will compile all your TypeScript files to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found