-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
51 lines (48 loc) · 1.08 KB
/
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
43
44
45
46
47
48
49
50
51
import path from 'path';
import webpack, { Configuration } from 'webpack';
import CopyWebpackPlugin from 'copy-webpack-plugin';
const ROOT = path.resolve(__dirname);
const DIST = path.resolve('./dist');
const CLIENT = path.resolve('./src/client');
const config: Configuration = {
context: ROOT,
entry: ['./src/client/index.tsx'],
output: {
path: DIST,
filename: 'client.js',
publicPath: '/'
},
module: {
rules: [{
test: /\.tsx?$/,
include: CLIENT,
loader: 'ts-loader',
options: {
configFile: path.resolve('./config/tsconfig.client.json')
}
}, {
test: /\.scss$/,
include: CLIENT,
use: [
'style-loader',
'css-loader',
'fast-sass-loader'
]
}]
},
resolve: {
alias: {
src: path.resolve('./src')
},
extensions: ['.js', '.ts', '.tsx']
},
plugins: [
new webpack.DefinePlugin({
__DEV__: !['production', 'test'].includes(process.env.NODE_ENV)
}),
new CopyWebpackPlugin([
{ from: 'src/client/index.html' }
])
]
};
export default config;