Webpack: convert git-loader to TypeScript

This commit is contained in:
Alex Gleason 2022-10-14 15:52:02 -05:00
parent b770cbb175
commit 239ccb807a
No known key found for this signature in database
GPG key ID: 7211D1F99744FBB7
3 changed files with 15 additions and 1 deletions

Binary file not shown.

View file

@ -0,0 +1,14 @@
import { resolve } from 'path';
import { LoaderContext } from 'webpack';
/**
* Forces recompile whenever the current commit changes.
* Useful for generating the version hash in the UI.
*/
function loader(this: LoaderContext<{}>, content: string) {
this.addDependency(resolve(__dirname, '../../.git/logs/HEAD'));
this.callback(undefined, content);
}
export default loader;

View file

@ -6,7 +6,7 @@ import type { RuleSetRule } from 'webpack';
const rule: RuleSetRule = {
test: resolve(__dirname, '../../app/soapbox/utils/code.js'),
use: {
loader: resolve(__dirname, '../loaders/git-loader.js'),
loader: resolve(__dirname, '../loaders/git-loader.ts'),
},
};