-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
28 lines (26 loc) · 1003 Bytes
/
webpack.config.ts
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
import path from 'path'
import HtmlWebpackPlugin from 'html-webpack-plugin'
import type webpack from 'webpack'
import { buildPlugins } from './config/build/buildPlugins'
import { buildLoaders } from './config/build/buildLoaders'
import { buildResolvers } from './config/build/buildResolvers'
import { buildWebpackConfig } from './config/build/buildWebpackConfig'
import { type BuildEnv, type BuildPaths } from './config/build/types/config'
export default (env: BuildEnv) => {
const paths: BuildPaths = {
entry: path.resolve(__dirname, 'src', 'index.tsx'),
build: path.resolve(__dirname, 'build'),
html: path.resolve(__dirname, 'public', 'index.html'),
src: path.resolve(__dirname, 'src')
}
const PORT = env.port || 3000
const mode = env.mode || 'development'
const isDev = mode === 'development'
const config: webpack.Configuration = buildWebpackConfig({
mode,
paths,
isDev,
port: PORT
})
return config
}