-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.ts
More file actions
21 lines (17 loc) · 796 Bytes
/
webpack.config.ts
File metadata and controls
21 lines (17 loc) · 796 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
import path from 'path'
import { type Configuration as WebpackConfiguration } from 'webpack'
import { type BuildEnv, type BuildMode, type BuildPaths } from './config/build/types/config'
import { buildWebpackConfig } from './config/build/buildWebpackConfig'
export default (env: BuildEnv): WebpackConfiguration => {
const mode: BuildMode = env.mode || 'development'
const isDev: boolean = mode === 'development'
const PORT = env.port || 3000
const paths: BuildPaths = {
entry: path.resolve(__dirname, 'src', 'index.tsx'),
build: path.resolve(__dirname, 'dist'),
html: path.resolve(__dirname, 'public', 'index.html'),
src: path.resolve(__dirname, 'src')
}
const config: WebpackConfiguration = buildWebpackConfig({ mode, paths, isDev, port: PORT })
return config
}