-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
42 lines (39 loc) · 1005 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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
import path from 'path';
import webpack from 'webpack';
import merge from 'webpack-merge';
import ForkTsCheckerWebpackPlugin from 'fork-ts-checker-webpack-plugin';
import HtmlWebpackPlugin from 'html-webpack-plugin';
const config =
process.env.NODE_ENV === 'production'
? require('./webpack.prod.config').default
: require('./webpack.dev.config').default;
const base: webpack.Configuration = {
entry: path.resolve('src', 'index.tsx'),
output: {
path: path.resolve(__dirname, 'dist'),
publicPath: '/dist/',
filename: '[name].js'
},
module: {
rules: [
{
test: /\.tsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.ts', '.tsx', '.js', '.json']
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'development'
}),
new ForkTsCheckerWebpackPlugin(),
new HtmlWebpackPlugin({
template: 'src/index.html'
})
]
};
export default merge(base, config);