-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
29 lines (25 loc) · 833 Bytes
/
webpack.config.ts
File metadata and controls
29 lines (25 loc) · 833 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
import webpack from 'webpack';
import { buildWebpack } from './config/build/buildWebpack';
import { BuildMode, BuildPaths } from './config/build/types/types';
import path from 'path';
interface EnvVariables {
mode?: BuildMode;
analyzer?: boolean;
port?: number;
}
export default (env: EnvVariables) => {
const paths: BuildPaths = {
output: path.resolve(__dirname, 'build'),
entry: path.resolve(__dirname, 'src', 'index.tsx'),
html: path.resolve(__dirname, 'public', 'index.html'),
public: path.resolve(__dirname, 'public'),
src: path.resolve(__dirname, 'src'),
}
const config: webpack.Configuration = buildWebpack({
port: env.port ?? 3000,
mode: env.mode ?? 'development',
paths,
analyzer: env.analyzer,
})
return config;
};