refactor(webpack): rewrite config to typescript

This commit is contained in:
Sergey Krylov 2024-06-04 06:01:21 +03:00
parent c17cca2b6f
commit 1ce1180ad7
5 changed files with 20 additions and 17 deletions

Binary file not shown.

4
src/global.d.ts vendored
View File

@ -1,5 +1 @@
/// <reference types="ksv741-react-scripts/global" />
declare module '*.css' {
export default Record<string, string>;
}

View File

@ -3,6 +3,7 @@
"./src",
"./configs",
"./jest.config.ts",
"./webpack.config.ts",
"./__spec__",
],
"compilerOptions": {
@ -51,5 +52,10 @@
"DOM"
],
"skipLibCheck": true
},
"ts-node": {
"compilerOptions": {
"module": "CommonJS"
}
}
}

View File

@ -1,13 +0,0 @@
const path = require('node:path');
const { createConfig } = require('ksv741-react-scripts');
module.exports = (env) => createConfig({
analyze: env?.analyze,
mode: env?.mode,
plugins: {
htmlWebpackPlugin: {
favicon: path.resolve(__dirname, 'public', 'favicon.png'),
},
},
});

14
webpack.config.ts Normal file
View File

@ -0,0 +1,14 @@
import path from 'path';
import {createConfig, WebpackEnv} from 'ksv741-react-scripts'
const config = (env: WebpackEnv) => createConfig({
analyze: Boolean(env?.analyze),
mode: env?.mode || 'development',
plugins: {
htmlWebpackPlugin: {
favicon: path.resolve(__dirname, 'public', 'favicon.png'),
},
},
});
export default config;