Webpack: convert rules to TypeScript
This commit is contained in:
parent
671210acad
commit
b770cbb175
12 changed files with 50 additions and 0 deletions
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
13
webpack/rules/git-refresh.ts
Normal file
13
webpack/rules/git-refresh.ts
Normal file
|
@ -0,0 +1,13 @@
|
|||
import { resolve } from 'path';
|
||||
|
||||
import type { RuleSetRule } from 'webpack';
|
||||
|
||||
/** Recompile code.js whenever git changes. */
|
||||
const rule: RuleSetRule = {
|
||||
test: resolve(__dirname, '../../app/soapbox/utils/code.js'),
|
||||
use: {
|
||||
loader: resolve(__dirname, '../loaders/git-loader.js'),
|
||||
},
|
||||
};
|
||||
|
||||
export default rule;
|
Binary file not shown.
23
webpack/rules/index.ts
Normal file
23
webpack/rules/index.ts
Normal file
|
@ -0,0 +1,23 @@
|
|||
import assets from './assets';
|
||||
import babel from './babel';
|
||||
import buildConfig from './babel-build-config';
|
||||
import git from './babel-git';
|
||||
import css from './css';
|
||||
import gitRefresh from './git-refresh';
|
||||
import nodeModules from './node_modules';
|
||||
|
||||
import type { RuleSetRule } from 'webpack';
|
||||
|
||||
// Webpack loaders are processed in reverse order
|
||||
// https://webpack.js.org/concepts/loaders/#loader-features
|
||||
const rules: RuleSetRule[] = [
|
||||
...assets,
|
||||
css,
|
||||
nodeModules,
|
||||
babel,
|
||||
git,
|
||||
gitRefresh,
|
||||
buildConfig,
|
||||
];
|
||||
|
||||
export default rules;
|
Binary file not shown.
14
webpack/rules/mark.ts
Normal file
14
webpack/rules/mark.ts
Normal file
|
@ -0,0 +1,14 @@
|
|||
import { env } from 'process';
|
||||
|
||||
import type { RuleSetRule } from 'webpack';
|
||||
|
||||
let rule: RuleSetRule = {};
|
||||
|
||||
if (env.NODE_ENV !== 'production') {
|
||||
rule = {
|
||||
test: /\.js$/,
|
||||
loader: 'mark-loader',
|
||||
};
|
||||
}
|
||||
|
||||
export default rule;
|
Binary file not shown.
Loading…
Reference in a new issue