-
Notifications
You must be signed in to change notification settings - Fork 113
/
webpack.common.conf.js
113 lines (112 loc) · 2.83 KB
/
webpack.common.conf.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
"use strict";
const webpack = require("webpack");
const autoprefixer = require("autoprefixer");
const path = require("path");
const CopyPlugin = require("copy-webpack-plugin");
const MiniCssExtractPlugin = require("mini-css-extract-plugin");
module.exports = {
entry: {
lutris: "./frontend/js/app.js",
editor: "./frontend/js/editor.js",
styles: "./frontend/css/lutris.scss"
},
output: {
path: path.resolve(__dirname, "public"),
filename: "js/[name].js",
// path to build relative asset links
publicPath: "../",
},
module: {
rules: [
{
test: /\.woff(2)?(\?v=[0-9]\.[0-9]\.[0-9])?$/,
include: path.resolve(__dirname, './node_modules/bootstrap-icons/font/fonts'),
use: {
loader: 'file-loader',
options: {
name: '[name].[ext]',
outputPath: 'webfonts',
publicPath: '../webfonts',
},
}
},
// expose jQuery to other scripts
{
test: require.resolve("jquery"),
use: [
{
loader: "expose-loader",
options: {
exposes: ["$", "jQuery"]
}
}
],
},
{
test: /\.(jpg|png|svg|bmp|gif)$/,
use: {
loader: "url-loader",
},
},
// styles loader
{
test: /\.(sa|sc|c)ss$/,
use: [MiniCssExtractPlugin.loader, "css-loader", "sass-loader"],
},
// fonts loader
{
test: /\.(woff|woff2|eot|ttf|otf)$/,
use: [
{
loader: "file-loader",
options: {
name: "fonts/[name].[ext]",
},
},
],
},
],
},
plugins: [
// save compiled SCSS into separated CSS file
new MiniCssExtractPlugin({
filename: "css/[name].css",
}),
new CopyPlugin({
patterns: [
{
from: path.resolve(__dirname, "node_modules/bootstrap-icons/font"),
to: "./css/"
},
{
from: path.resolve(__dirname, "node_modules/blueimp-gallery/css"),
to: "./css/"
},
{
from: path.resolve(__dirname, "node_modules/blueimp-gallery/js"),
to: "./js/"
},
{
from: path.resolve(__dirname, "node_modules/blueimp-gallery/img"),
to: "./img/"
},
{
from: path.resolve(__dirname, "node_modules/croppie/*.js"),
to: "./js/[name][ext]"
},
{
from: path.resolve(__dirname, "node_modules/croppie/*.css"),
to: "./css/[name][ext]"
},
],
}),
// provide jQuery and Popper.js dependencies
new webpack.ProvidePlugin({
$: "jquery",
jquery: "jquery",
"window.jQuery": "jquery",
"window.$": "jquery",
Popper: "@popperjs/core"
}),
]
};