-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
46 lines (42 loc) · 1.55 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
45
46
const path = require('path');
const CssMinimizerPlugin = require("css-minimizer-webpack-plugin");
const TerserPlugin = require("terser-webpack-plugin");
module.exports = {
entry: [path.resolve(__dirname, 'elliotpowell/portfolio/src/portfolio/index.tsx')],
module: {
// configuration regarding modules
rules: [
{
// regex test for js and jsx files as well as ts and tsx files
test: /\.(js|jsx|ts|tsx)?$/,
// don't look in any node_modules/ or bower_components/ folders
exclude: /(node_modules|bower_components)/,
// for matching files, use the babel-loader
use: {
loader: "babel-loader",
options: { presets: ["@babel/env"] }
},
},
{
test: /\.css$/,
use: ["style-loader", "css-loader"]
}
],
},
resolve: { extensions: ["*", ".js", ".jsx", ".ts", ".tsx"] },
optimization: {
usedExports: true,
minimizer: [new TerserPlugin({ parallel: 4, extractComments: "all", terserOptions: { compress: true } }), new CssMinimizerPlugin()],
},
output: {
// where compiled files go
path: path.resolve(__dirname, "elliotpowell/portfolio/static/portfolio/public/dist"),
publicPath: "/static/portfolio/public/dist/",
filename: 'main.js', // the same one we import in index.html
},
devServer: {
devMiddleware: {
writeToDisk: true,
},
}
};