-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.ts
75 lines (73 loc) · 1.83 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
import * as autoprefixer from "autoprefixer";
import * as path from "path";
import * as webpack from "webpack";
import "webpack-dev-server"; // Side-effect import just to get devServer types.
const config: webpack.Configuration = {
entry: "./docs/docs.jsx",
output: {
path: path.resolve(__dirname, "docs"),
filename: "bundle.js",
publicPath: "/",
},
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".less"],
alias: {
src: path.resolve(__dirname, "src"),
utils: path.resolve(__dirname, "src/utils"),
less: path.resolve(__dirname, "src/less"),
},
},
module: {
rules: [
{
test: /\.(eot|otf|woff|svg|ttf|png|jpg)$/,
loader: "url-loader",
},
{
test: /\.(less|css)$/,
use: [
"style-loader",
"css-loader",
{
loader: "postcss-loader",
options: {
postcssOptions: {
plugins: [autoprefixer],
},
},
},
"less-loader",
],
},
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader",
options: {
configFileName: "./tsconfig.docs.json",
ignoreDiagnostics: [2307],
},
},
{
test: /\.jsx?$/,
exclude: /node_modules/,
loader: "babel-loader",
},
],
},
optimization: {
nodeEnv: process.env.NODE_ENV || "development",
},
devServer: {
host: "0.0.0.0",
port: 5010,
contentBase: "docs/",
inline: true,
watchContentBase: true,
hot: true,
// The following property is HIGHLY DISCOURAGED in general but can be useful
// for viewing the frontend from another device (i.e a phone) by navigating
// to <laptop-ip>:<port> from the device.
// disableHostCheck: true
},
};
export default config;