-
Notifications
You must be signed in to change notification settings - Fork 4
/
webpack.dev.js
113 lines (111 loc) · 3.25 KB
/
webpack.dev.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
const path = require("path");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const WebpackBar = require("webpackbar");
const webpack = require("webpack");
const consts = require("./consts");
const stringifiedConstants = Object.assign({}, consts);
Object.keys(stringifiedConstants).forEach((c) => {
stringifiedConstants[c] = JSON.stringify(stringifiedConstants[c]);
});
module.exports = {
mode: "development",
devServer: {
static: path.join(__dirname, "bin"),
compress: true,
port: 8080,
//hot: true,
//noInfo: true,
//disableHostCheck: true,
},
infrastructureLogging: {
level: "warn"
},
entry: {
xbstyles: "./src/css/styles.scss",
xbreader: "./src/app/index.ts",
loader: "./src/app/loader.js"
},
output: {
path: path.resolve(__dirname, "./bin"),
publicPath: "/",
filename: "[name].js"
},
module: {
rules: [{
test: /\.tsx?$/,
exclude: /node_modules/,
loader: "ts-loader"
}, {
test: /\.js$/,
exclude: /node_modules/,
loader: "babel-loader"
},
{
test: /\.mjs$/,
include: /node_modules/,
type: "javascript/auto"
},
{
test: /\.(s*)css$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader",
options: {
sourceMap: true
}
},
{
loader: "sass-loader",
options: {
sourceMap: true,
sassOptions: {
includePaths: [
"./src/css",
"./node_modules"
]
}
}
}
]
}]
},
resolve: {
extensions: [ ".tsx", ".ts", ".js", ".jsx" ],
alias: {
"@r2-utils-js": "r2-utils-js/dist/es5/src",
"@r2-lcp-js": "r2-lcp-js/dist/es5/src",
"@r2-opds-js": "r2-opds-js/dist/es5/src",
"@r2-shared-js": "r2-shared-js/dist/es5/src",
"@r2-streamer-js": "r2-streamer-js/dist/es5/src",
"@r2-navigator-js": "r2-navigator-js/dist/es5/src",
"xbreader": path.resolve(__dirname, "src/app/")
},
fallback: {
"util": require.resolve("util/")
}
},
target: "web",
plugins: [
new WebpackBar({
name: "XBReader"
}),
new HtmlWebpackPlugin({
title: "XBReader",
template: "src/index.html",
favicon: "src/favicon.ico",
excludeChunks: ["xbreader"],
extra: {
v: consts.__VERSION__
}
}),
new MiniCssExtractPlugin({
filename: "[name].css"
}),
new webpack.DefinePlugin(stringifiedConstants),
new webpack.DefinePlugin({
"process.env.NODE_DEBUG": JSON.stringify(process.env.NODE_DEBUG)
})
]
};