ha-frontend-cdce8p/build-scripts
Paulus Schoutsen 0046252e32
Add selectors to ha-form (#11534)
2022-02-04 12:47:21 +01:00
..
babel-plugins Inline mdi icons with babel plugin + bump build deps (#9498) 2021-07-12 09:26:07 -07:00
gulp Use page instead of demo (#11118) 2022-01-06 22:32:10 -08:00
rollup-plugins Bump @web/dev-server (#7792) 2020-11-24 12:04:22 +01:00
.eslintrc Gulpify build pipeline (#3145) 2019-05-02 11:35:46 -07:00
.eslintrc.json Gulpify build pipeline (#3145) 2019-05-02 11:35:46 -07:00
README.md Clarify title 2020-11-18 08:46:42 +00:00
bundle.js Add selectors to ha-form (#11534) 2022-02-04 12:47:21 +01:00
env.js Move to `setup.cfg` and config for `build-system` (#11484) 2022-01-28 21:18:17 -08:00
paths.js Reorganize gallery (#11116) 2022-01-06 20:20:57 -08:00
removedIcons.json Remove deprecated icons (#10622) 2021-11-15 11:54:59 +01:00
rollup.js Disable babel compact option (#9335) 2021-06-03 12:34:30 -07:00
util.js Silence babel warnings (#9158) 2021-05-10 22:57:42 +02:00
webpack.js Add selectors to ha-form (#11534) 2022-02-04 12:47:21 +01: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.