forked from packit/dashboard
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
107 lines (104 loc) · 3.86 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
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
/*
* We are transpiling everything imported by our input files the in the ./frontend folder
* (JSX/JS/CSS/Images), minifying it and then putting it in the ./static/dist folder.
*/
const path = require("path");
module.exports = {
entry: {
app: path.join(__dirname, "/frontend/app.js"),
},
module: {
rules: [
// Convert JSX (HTML in JavaScript) to JS
{
test: /\.js$/,
exclude: /node_modules/,
use: "babel-loader",
},
// Take care of images which are imported by JS
{
test: /\.(svg|png|jpg|jpeg|gif)$/,
loader: "file-loader",
options: {
name: "[name].[ext]",
outputPath: "../../static/dist/img",
},
},
{
test: /\.(svg|ttf|eot|woff|woff2)$/,
// only process modules with this loader
// if they live under a 'fonts' or 'pficon' directory
include: [
path.resolve(
__dirname,
"node_modules/patternfly/dist/fonts"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-core/dist/styles/assets/fonts"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-core/dist/styles/assets/pficon"
),
path.resolve(
__dirname,
"node_modules/@patternfly/patternfly/assets/fonts"
),
path.resolve(
__dirname,
"node_modules/@patternfly/patternfly/assets/pficon"
),
],
use: {
loader: "file-loader",
options: {
outputPath: "../../static/dist/fonts",
name: "[name].[ext]",
},
},
},
// CSS, maybe add SCSS if needed later
{
test: /\.css$/,
include: [
path.resolve(__dirname, "frontend"),
path.resolve(__dirname, "node_modules/patternfly"),
path.resolve(
__dirname,
"node_modules/@patternfly/patternfly"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-styles/css"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-core/dist/styles/base.css"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-core/dist/esm/@patternfly/patternfly"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-core/node_modules/@patternfly/react-styles/css"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-table/node_modules/@patternfly/react-styles/css"
),
path.resolve(
__dirname,
"node_modules/@patternfly/react-inline-edit-extension/node_modules/@patternfly/react-styles/css"
),
],
use: ["style-loader", "css-loader"],
},
],
},
output: {
path: __dirname + "/static/dist",
filename: "[name].bundle.js",
},
};