Questions tagged [tsickle]

For questions about the TypeScript compiler for the Google Closure Javascript framework.

The Google Closure is a a strongly-typed extension of the Javascript language, and also a Javascript obfuscator and optimizer. Contrary the better known Typescript, it uses remarks for the typing metadata.

Typescript uses the tsc (typescript compiler) to generate Javascript code. Its optimization possibilities are below of the Google Closure Compiler.

Tsickle converts TypeScript code into a form acceptable to the Closure Compiler. Large frameworks (Angular) can not be compiled with tsickle today. In the case smaller projects, it can reach a huge size decrease and speed improvement to the common solutions (tsc + webpack).

References

9 questions
16
votes
2 answers

Closure Compiler + Typescript

I want to use Typescript and then Closure Compile (advanced compilation) to target ES5 and minify the output. Do I have to use tsickle in place of tsc? It lacks support for all the options tsc has, and is far ambitious in that it wants to translate…
Paul Draper
  • 78,542
  • 46
  • 206
  • 285
7
votes
3 answers

Can't create new project in Angular: tsickle dependency problem

I've installed: node.js v15.6.0 npm 7.5.0 Angular CLI: 11.1.2 I'm running on Windows 10, 64bit. I'm trying to create my first project by running: ng new angular-demo where "angular-demo" is project name. The command creates a project directory…
4
votes
0 answers

Angular 2 transpiled with tsickle can't be processed by google-closure-compiler

I have an Angular 2 typescript project that I would like to bundle into one JS file. Bootstrapper: main.ts import {platformBrowser} from '@angular/platform-browser'; import {AppModuleNgFactory} from '../aot/dev/app/app.module.ngfactory' //generated…
2
votes
0 answers

Closure Compiler does not remove dead code from self invoking functions

I'm writing a TypeScript app which takes two numbers and prints the sum of the numbers to the console. calculator2.ts: export namespace calculator { export function add(a: number, b: number): number { return a + b; } export…
user7353781
  • 155
  • 2
  • 10
1
vote
2 answers

Failed to build angular 7 component library

I once created component lib in angular version 11 smoothly without any problems, but when I created component lib in angular version 7, I got an error when ng build component lib Cannot find module 'tsickle/src/tsickle' Require stack: -…
0
votes
0 answers

Compiling TypeScript sources through ngc TypeError: Cannot read property 'directoryExists' of undefined

Updated from Angular CLI 1.7.0 to Angular 8. Got everything working locally but failing on Build definition in 'npm packager' step. Initially got error on missing tstickle and after adding it to package.json, "tsickle":…
Anuj Vohra
  • 11
  • 1
  • 3
0
votes
2 answers

exported enums won't compile with tsickle/closure

I am trying to compile an angular project with the new tsickle/closure chain. However, it seems to have to following errors on all enums: src/path/to/YourEnumType.ts:1: ERROR - Exports must be a statement at the top-level of a module My code is…
peterh
  • 11,875
  • 18
  • 85
  • 108
0
votes
1 answer

Trying to compile angular5 project with tsickle/closure, I get "The body of a goog.module cannot reference this."

I am trying to compile a relative complex angular5 project with google closure. First I use tsickle to compile the code into a google closure-friendly syntax, and then I try to use the google closure to create the final bundle. Unfortunately,…
peterh
  • 11,875
  • 18
  • 85
  • 108
-5
votes
1 answer

Tsickle says "Error No inputs were found in config file" if I call it with tsconfig.json in a different directory

Calling tsickle with tsickle --externs=target/externs.js -- -p target/src I get this error: Error No inputs were found in config file 'target/src/tsconfig.json'. Specified 'include' paths were '["./my/pathes/**/*.ts"]' and 'exclude' paths were…
peterh
  • 11,875
  • 18
  • 85
  • 108