-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathwebpack.config.js
More file actions
72 lines (63 loc) · 1.59 KB
/
webpack.config.js
File metadata and controls
72 lines (63 loc) · 1.59 KB
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
const { CheckerPlugin } = require("awesome-typescript-loader");
const { resolve, join, basename, dirname } = require("path");
const pkg = require("./package.json");
const HOST = process.env.npm_package_config_host || pkg.config.host;
const PORT = process.env.npm_package_config_port || pkg.config.port;
const LIBRARY = process.env.npm_package_config_library || pkg.config.library;
const MAIN = pkg.main;
const FILENAME = basename(MAIN);
const PATH = dirname(MAIN);
module.exports = {
mode: process.env.WEBPACK_SERVE ? "development" : "production",
entry: {
loader: "./src/index.ts"
},
output: {
filename: FILENAME,
path: join(__dirname, PATH),
publicPath: "/",
library: LIBRARY,
libraryTarget: "var",
globalObject: "this"
},
devtool: "source-map",
resolve: {
extensions: [".ts", ".tsx", ".js", ".jsx", ".json"]
},
module: {
rules: [
{
test: /\.worker\.tsx?$/,
loader: "worker-loader"
},
{
test: /\.tsx?$/,
loader: "awesome-typescript-loader",
exclude: resolve(__dirname, "node_modules"),
include: [resolve(__dirname, "src"), resolve(__dirname, "typings")]
},
{
enforce: "pre",
test: /\.js$/,
loader: "source-map-loader"
},
{
test: /\.(png|woff|woff2|eot|ttf|svg)$/,
use: [
{
loader: "url-loader",
options: {
limit: 100000
}
}
]
}
]
},
plugins: [new CheckerPlugin()],
serve: {
host: HOST,
port: PORT,
content: [__dirname]
}
};