-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.ts
50 lines (48 loc) · 1.14 KB
/
webpack.config.ts
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
import HtmlWebpackPlugin from "html-webpack-plugin";
import * as path from "path";
import * as webpack from "webpack";
import "webpack-dev-server";
// Basic Webpack config for TypeScript, based on
// https://webpack.js.org/guides/typescript/ .
const config: webpack.Configuration = {
// mode and devtool are overridden by `npm run build` for production mode.
mode: "development",
devtool: "eval-source-map",
entry: "./src/main.ts",
module: {
rules: [
{
test: /\.tsx?$/,
use: "ts-loader",
exclude: /node_modules/,
},
{
test: /\.js$/,
enforce: "pre",
use: ["source-map-loader"],
},
// Other loaders here...
],
},
resolve: {
extensions: [".tsx", ".ts", ".js"],
},
output: {
filename: "[name].bundle.js",
path: path.resolve(__dirname, "dist"),
clean: true,
},
plugins: [
// Use src/index.html as the entry point.
new HtmlWebpackPlugin({
template: "./src/index.html",
}),
],
// webpack-dev-server config.
devServer: {
port: 3000,
compress: true,
static: path.join(__dirname, "dist"),
},
};
export default config;