- Gif bundling is required for updated rewards tip dialog designs.
- Webpack was previously bundling a polyfill for Node's stream module
due to a detected dependency in "styled-components".
- Removed unused variables.
ts-loader is webpack's more supported method of loading typescript files.
It's also faster for us.
Storybook compile goes from 3mins to 40s.
Storybook hot-reload compile goes from 7s to 2s
Regular NTP webpack build time stays the same (12s)
Aids devtools usage. Instead of just the classname "iHRorp", an element will get an additional className to identify the component name, e.g. "Header-sc-ofpjq6 iHRorp"
WebTorrent now includes a built-in shim for require('dns')
in Chrome Apps. The shim is published at:
https://www.npmjs.com/package/chrome-dns
So we no longer need to include a DNS shim for WebTorrent
in Brave itself. This is the last bit of "hackiness" that
we had to remove. Now Brave is effectively shipping
WebTorrent out-of-the-box.
Fixes: https://github.com/brave/brave-browser/issues/5606
Add a new custom plugin for webpack which keeps track of every require (or import) module path, and provide a list of these for ninja. After this, build targets which use this template will not need to provide an input list of every JS / TS / CSS / etc file that is used for the build. Instead ninja will use this new generated file to keep track of which files should cause a re-build of a specific target when they are changed.
Tested with:
- Removing inputs of a webpack target
- Generated depfile contains relevant inputs
- Target only builds when an item in the generated depfile is changed
Note that the file path used in the header of the depfile must match precisely the output of the target. If this is different then the target will always be re-built as the depfile will be invalid.
Babel dependencies were configured but not actually used by any webui bundles since they are all typescript.
Typescript was not configured to output using the latest features supported by v8.
This re-configuration ensures:
- TS output is transpiled to es2017 JS and no further, which should allow for optimizations. Previously it was es5.
- es module syntax is preserved, allowing webpack to tree shake
- async lazy-load import() syntax is preserved, allowing webpack to perform chunking
This also fixes an issue whereby linking brave-ui dependency from a local path would prevent webui compilation.