-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
44 lines (43 loc) · 1.24 KB
/
webpack.config.js
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
const path = require("path");
const CleanWebpackPlugin = require('clean-webpack-plugin').CleanWebpackPlugin;
const HtmlWebpackPlugin = require('html-webpack-plugin');
module.exports = env => {
return {
output: {
path: path.resolve('./dist'),
publicPath: '',
filename: "[name].js",
assetModuleFilename: '[path][name][ext]'
},
entry: [
'./src/index.ts'
],
devtool: env && env.production ? 'none' : 'source-map',
devServer: {
contentBase: './dist'
},
resolve: {
extensions: ['.ts', '.tsx', '.js']
},
module: {
rules: [{
test: /\.tsx?$/,
use: 'ts-loader',
exclude: /node_modules/
},
{
test: /\.png|jpg|jpeg|svg|glib/,
type: 'asset/resource'
}
]
},
plugins: [
// Cleans the dist folder before the build starts
new CleanWebpackPlugin(),
// Generate a base html file and injects all generated css and js files
new HtmlWebpackPlugin({
template: 'index.html'
})
]
};
};