-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
48 lines (46 loc) · 1.03 KB
/
Copy pathwebpack.config.js
File metadata and controls
48 lines (46 loc) · 1.03 KB
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
const path = require('path');
const HtmlPlugin = require('html-webpack-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const isDev = process.env.NODE_ENV === 'development';
module.exports = {
mode: isDev ? 'development' : 'production',
entry: isDev
? path.join(__dirname, '/example/index.ts')
: path.join(__dirname, '/src/index.ts'),
output: {
path: path.join(__dirname, isDev ? '/example/dist' : '/dist'),
filename: 'index.js',
},
module: {
rules: [
{
test: /\.ts$/,
use: 'ts-loader',
exclude: /node_modules/
}
]
},
resolve: {
extensions: ['.js', '.ts'],
},
plugins: isDev ? [
new HtmlPlugin({
template: path.join(__dirname, '/example/public/index.html')
})
] : [
new CleanWebpackPlugin()
],
devServer: {
port: '4396',
hot: true,
static: [
{
directory: path.join(__dirname, '/example/dist')
},
{
directory: path.join(__dirname, '/example/assets'),
publicPath: '/assets',
}
]
}
};