Reopen: ng-xi18n tool compiles TypeScript files
See original GitHub issueSorry 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:
- Created 7 years ago
- Reactions:2
- Comments:14 (8 by maintainers)
The issue here is that we call
tsc.main()
in theextract_i18n.ts
- we should actually have a stripped down version of this function copied over toextract_18n.ts
and remove the emit part.@vicb what are talking about? In the angular2-seed project you see the
outDir
property in thetsconfig.json
file. This was mentioned in #12305.Your example shows the problem!
npm run build
and you will seemain.bundle.js
andmain.map
in thedist
directory. This is the webpack2 result../node_modules/.bin/ng-xi18n
and you will see asrc
directory with.js
,.js.map
and.metadata.json
files in thedist
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 thetsconfig.json
file (https://angular.io/docs/ts/latest/guide/webpack.html). So remove this property and then yoursrc
directory will be full with.js
,.js.map
and.metadata.json
files.So please reopen #12305 or this issue, thanks!