home-assistant-frontend/build-scripts
renovate[bot] 1df9c38a8c
Update dependency tar to v7 (#20513)
* Update dependency tar to v7

* Update fetch-nightly-translations.js

---------

Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
Co-authored-by: Bram Kragten <mail@bramkragten.nl>
2024-04-15 13:40:38 +00:00
..
babel-plugins Inject polyfills where used (#18719) 2023-11-24 15:57:21 +01:00
gulp Update dependency tar to v7 (#20513) 2024-04-15 13:40:38 +00:00
rollup-plugins Make module types explicit and convert some to ESM (#15964) 2023-03-30 11:23:43 +02:00
.eslintrc.json Fetch nightly translations during build (#13724) 2022-11-29 19:33:43 +01:00
README.md Clarify title 2020-11-18 08:46:42 +00:00
bundle.cjs Update dependency core-js to v3.34.0 (#18974) 2023-12-22 15:41:33 -05:00
env.cjs Make module types explicit and convert some to ESM (#15964) 2023-03-30 11:23:43 +02:00
list-plugins-and-polyfills.js Enable shipped proposals in Babel (#17909) 2023-09-19 13:56:55 +02:00
paths.cjs Make module types explicit and convert some to ESM (#15964) 2023-03-30 11:23:43 +02:00
removedIcons.json Remove deprecated and removed icons (#15762) 2023-03-08 12:28:34 +01:00
rollup.cjs Export base create config functions (#17007) 2023-06-26 09:50:43 +02:00
webpack.cjs Fix search input outlined background color and margin (#20407) 2024-04-04 12:53:03 +02:00

README.md

Bundling Home Assistant Frontend

The Home Assistant build pipeline contains various steps to prepare a build.

  • Generating icon files to be included
  • Generating translation files to be included
  • Converting TypeScript, CSS and JSON files to JavaScript
  • Bundling
  • Minifying the files
  • Generating the HTML entrypoint files
  • Generating the service worker
  • Compressing the files

Converting files

Currently in Home Assistant we use a bundler to convert TypeScript, CSS and JSON files to JavaScript files that the browser understands.

We currently rely on Webpack but also have experimental Rollup support. Both of these programs bundle the converted files in both production and development.

For development, bundling is optional. We just want to get the right files in the browser.

Responsibilities of the converter during development:

  • Convert TypeScript to JavaScript
  • Convert CSS to JavaScript that sets the content as the default export
  • Convert JSON to JavaScript that sets the content as the default export
  • Make sure import, dynamic import and web worker references work
    • Add extensions where missing
    • Resolve absolute package imports
  • Filter out specific imports/packages
  • Replace constants with values

In production, the following responsibilities are added:

  • Minify HTML
  • Bundle multiple imports so that the browser can fetch less files
  • Generate a second version that is ES5 compatible

Configuration for all these steps are specified in bundle.js.