@blotch/angular-lynx-build
The Angular CLI builders behind ng build, ng serve, ng test and ng extract-i18n on Lynx. It's the only build dependency your app needs, as @angular/build is for a web app. RSpeedy (the Lynx build tool), the AngularLynx plugin and the native app builder come with it.
Usage
ng add @blotch/angular-lynx installs it and points your angular.json targets at it:
They work like Angular's builders:
- Configurations and flags override options, so
-c developmentand--source-mapwork. optimizationpicks the build. A build that optimizes scripts is a production build. Any other build is a development build, with dev mode on. There's nomodeoption.ng build's bundles load their images from where they're deployed, in a development build too: from inside the app, or from your server with RSpeedy'soutput.assetPrefix. Onlyng serveloads them from its dev server.
application
ng build compiles your app into bundles, the files the Lynx engine runs. For a walkthrough, see Build your app.
Build options
Angular options
These are Angular's own application builder options, and they work as they do in a web app:
browser, tsConfig, polyfills, styles, inlineStyleLanguage, fileReplacements, aot (default true), sourceMap, outputHashing, i18nMissingTranslation
A few work differently on Lynx:
Native app options
ng build --platform reads these. Set the app identity, Turn on device features, Permissions and Publish to the app stores explain how to set them.
The signing fields name environment variables, so no secret goes in angular.json. See signing.
dev-server
ng serve runs RSpeedy's dev server. Lynx Explorer and the web preview load your app from it. With --platform, so does a development build of your app, which it opens on a simulator, emulator or phone (see Develop in the real app).
When the port is taken, ng serve does what Angular's dev server does. That holds wherever the port came from: PORT, --port, lynx.config.ts or the default.
-
In a terminal, it asks whether to use a different port.
-
Anywhere else (CI, a script), it fails:
-
PORT=0, or--port 0whenPORTisn't set, lets the system pick a port. -
It never moves to the next free port, as
rspeedy devdoes. A proxy, a script oradb reverseset up for the port would miss a server that moved, without a word. -
server.strictPortinlynx.config.tsdoesn't change this. Rsbuild, which RSpeedy runs on, fills in its defaultstrictPort: falsebeforeng servesees the config, so the two can't be told apart. Choose another port with--port.
unit-test
ng test runs Angular's @angular/build:unit-test builder with Vitest. It takes the same options (include, watch, coverage, setupFiles, providersFile, ...). include defaults to both **/*.spec.ts and **/*.test.ts.
For Lynx, it also:
- defines the compile-time flags the AngularLynx runtime reads;
- loads the setup of
@blotch/angular-lynx-testing-librarywhen your project has it, sorender()works without a setup file; - loads both after your polyfills. Those are the build target's
polyfills, unless thetesttarget has its ownpolyfills(Angular 22.3 added the option). The tests then load that list in place of the app's, and"polyfills": []loads none of them; - loads imported images, fonts and media as file URLs, as RSpeedy does in the app.
It runs your project's own @angular/build, which must match your Angular version. See Testing for writing tests.
extract-i18n
ng extract-i18n runs Angular's @angular/build:extract-i18n builder. It takes the same options (format, outputPath, outFile, ...). Angular CLI picks an extractor by itself only for Angular's own build builders, so an AngularLynx app needs this target in angular.json. ng add writes it, and add-i18n sets it to write JSON to src/locale.
For Lynx, it also loads imported images, fonts and media as file URLs, as in ng test. Angular's extractor stops at the first imported image otherwise.
It needs @angular/localize, which add-i18n installs. See Internationalization.
lynx.config.ts
Your app doesn't need one. Without it, the builders configure RSpeedy from angular.json:
Add a lynx.config.ts to the project root to change anything else RSpeedy supports, or to pass the AngularLynx plugin options. Your settings replace the defaults above, except mode, which always follows optimization.
The builders use the plugin you list instead of adding their own. Import from @blotch/angular-lynx-build, not @lynx-js/rspeedy or @blotch/rsbuild-plugin-angular-lynx. Those are its dependencies, not your app's, so strict package managers (pnpm, Yarn PnP) can't resolve them.
Plugin options
pluginAngularLynx() compiles Angular for Lynx. All of its options are optional.
Build
CSS
Gestures and accessibility
Deprecated
enableICU, enableParallelElement and pipelineSchedulerConfig have no effect, and never did: the plugin never passed them to Lynx, and Lynx's own build plugin no longer takes them. The build warns when your config sets one. Remove them; a future release drops them.
Without the Angular CLI
To run RSpeedy yourself, install @blotch/rsbuild-plugin-angular-lynx and import the plugin from there. Nothing adds it for you, so list it in lynx.config.ts and set source.entry.
