-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
41 lines (40 loc) · 1009 Bytes
/
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
const path = require('path');
module.exports = function webpackConfig(env, args) {
return {
entry: path.join(__dirname, 'src/index.tsx'),
output: {
filename: 'main.js',
path: path.join(__dirname, 'public'),
},
resolve: { extensions: ['.tsx', '.js', '.ts', '.md', '.css'] },
module: {
rules: [
{
test: /\.[jt]sx?$/,
exclude: /node_modules/,
loader: require.resolve('babel-loader'),
// See .babelrc for further babel config
},
{
test: /\.css$/i,
use: ['style-loader', 'css-loader'],
},
{
test: /\.md/,
type: 'asset/source',
},
],
},
optimization: {
minimizer: [
// Omit creation of .txt files
new (require('terser-webpack-plugin'))({ extractComments: false }),
],
},
devServer: {
hot: true,
open: false,
static: { directory: path.join(__dirname, 'public') },
},
};
};