-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
38 lines (37 loc) · 1005 Bytes
/
webpack.config.js
File metadata and controls
38 lines (37 loc) · 1005 Bytes
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
const path = require("path");
module.exports = {
mode: "production",
// webpack starts building the dependecy graph from here..
entry: "./src/index.tsx",
// the bundled files come here.
output: {
path: path.resolve(__dirname, "./dist"),
filename: "bundle.js",
},
module: {
// the way how to webpack handles files
rules: [
{
test: /\.(js|ts)x?$/,
exclude: /node_modules/,
use: {
loader: "babel-loader",
},
},
],
},
// how to resolve extensions in order. if the files have same name, webpack will resolve the file in order below
resolve: {
extensions: [".tsx", ".ts", ".jsx", ".js"],
},
// webpack-dev-server module picks up these options
devServer: {
// static files gonna be served from here. Default is 'public' directory
static: {
directory: path.resolve(__dirname, "./dist"),
},
},
performance: {
hints: process.env.NODE_ENV === "production" ? "warning" : false,
},
};