-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
52 lines (46 loc) · 1.2 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
47
48
49
50
51
52
const path = require("path");
const HtmlWebPackPlugin = require("html-webpack-plugin");
// Instantiate the plugin.
// The `template` property defines the source
// of a template file that this plugin will use.
// We will create it later.
const htmlPlugin = new HtmlWebPackPlugin({
template: "./src/index.html",
});
module.exports = {
// Our application entry point.
entry: "./src/index.tsx",
// These rules define how to deal
// with files with given extensions.
// For example, .tsx files
// will be compiled with ts-loader,
// a spcific loader for webpack
// that knows how to work with TypeScript files.
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
],
},
// Telling webpack which extensions
// we are interested in.
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
// What file name should be used for the result file,
// and where it should be palced.
output: {
filename: "bundle.js",
path: path.resolve(__dirname, "dist"),
},
// Use the html plugin.
plugins: [htmlPlugin],
devServer: {
contentBase: path.join(__dirname, "dist"),
compress: true,
port: 8000,
},
};