-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
64 lines (63 loc) · 1.53 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
53
54
55
56
57
58
59
60
61
62
63
64
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
const path = require("path");
module.exports = {
target: "web", // Our app can run without electron
entry: ["./app/src/index.js"],
output: {
path: path.resolve(__dirname, "app/dist"),
filename: "bundle.js"
},
module: {
rules: [
{
// loads .html files
test: /\.(html)$/,
include: [path.resolve(__dirname, "app/src")],
use: {
loader: "html-loader",
options: {
attributes: {
"list": [{
"tag": "img",
"attribute": "data-src",
"type": "src"
}]
}
}
}
},
// loads .js/jsx files
{
test: /\.jsx?$/,
include: [path.resolve(__dirname, "app/src")],
loader: "babel-loader",
resolve: {
extensions: [".js", ".jsx", ".json"]
}
},
// loads .css files
{
test: /\.css$/,
include: [
path.resolve(__dirname, "app/src"),
path.resolve(__dirname, "node_modules/typeface-roboto"),
path.resolve(__dirname, "node_modules/typeface-roboto-mono")
],
use: [
MiniCssExtractPlugin.loader,
{
loader: "css-loader"
}
],
resolve: {
extensions: [".css"]
}
},
// loads common image formats
{
test: /\.(eot|woff|woff2|ttf|svg|png|jpg|gif)$/,
use: "url-loader"
}
]
}
};