Webpack: convert git-loader to TypeScript
This commit is contained in:
parent
b770cbb175
commit
239ccb807a
3 changed files with 15 additions and 1 deletions
Binary file not shown.
14
webpack/loaders/git-loader.ts
Normal file
14
webpack/loaders/git-loader.ts
Normal 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;
|
|
@ -6,7 +6,7 @@ import type { RuleSetRule } from 'webpack';
|
||||||
const rule: RuleSetRule = {
|
const rule: RuleSetRule = {
|
||||||
test: resolve(__dirname, '../../app/soapbox/utils/code.js'),
|
test: resolve(__dirname, '../../app/soapbox/utils/code.js'),
|
||||||
use: {
|
use: {
|
||||||
loader: resolve(__dirname, '../loaders/git-loader.js'),
|
loader: resolve(__dirname, '../loaders/git-loader.ts'),
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue