34 lines
714 B
TypeScript
34 lines
714 B
TypeScript
import path from 'path';
|
|
|
|
import { createConfig } from 'ksv741-react-scripts';
|
|
import { InjectManifest } from 'workbox-webpack-plugin';
|
|
|
|
import type { WebpackEnv } from 'ksv741-react-scripts';
|
|
|
|
const config = (env: WebpackEnv) => {
|
|
const baseConfig = createConfig({
|
|
analyze: Boolean(env.analyze),
|
|
mode: env.mode ?? 'development',
|
|
devServer: {
|
|
port: 3003,
|
|
},
|
|
plugins: {
|
|
htmlWebpackPlugin: {
|
|
favicon: path.resolve(__dirname, 'public', 'favicon.png'),
|
|
},
|
|
},
|
|
});
|
|
|
|
const swPlugin = new InjectManifest({
|
|
swSrc: './src/src-sw.js',
|
|
swDest: 'sw.js',
|
|
});
|
|
|
|
// @ts-ignore
|
|
baseConfig.plugins.push(swPlugin);
|
|
|
|
return baseConfig;
|
|
};
|
|
|
|
export default config;
|