-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.js
55 lines (52 loc) · 1.85 KB
/
webpack.common.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
const path = require("path");
const fs = require("fs");
const HtmlWebpackPlugin = require("html-webpack-plugin");
const webpack = require("webpack");
const SVGSpritemapPlugin = require("svg-spritemap-webpack-plugin");
const Dotenv = require("dotenv-webpack");
const pages = fs
.readdirSync(path.resolve(__dirname, "src"))
.filter((fileName) => fileName.endsWith(".twig"));
module.exports = {
entry: "./src/js/index.js",
resolve: {
extensions: [".js", ".scss", ".css"],
alias: {
assets: path.resolve(__dirname, "src/assets"),
vue$: "vue/dist/vue.esm.js",
},
},
plugins: [
new Dotenv({systemvars: true, allowEmptyValues: true, safe: true}),
...pages.map(
(page) =>
new HtmlWebpackPlugin({
template: "src/" + page,
filename: page.replace(".twig", ".html"),
inject: true,
})
),
new SVGSpritemapPlugin("src/assets/icons/**/*.svg", {
output: {
filename: "assets/icons/icons.svg",
},
}),
new webpack.ProvidePlugin({
$: "jquery",
jQuery: "jquery",
"window.jQuery": "jquery",
Popper: ["popper.js", "default"],
Alert: "exports-loader?Alert!bootstrap/js/dist/alert",
Button: "exports-loader?Button!bootstrap/js/dist/button",
Carousel: "exports-loader?Carousel!bootstrap/js/dist/carousel",
Collapse: "exports-loader?Collapse!bootstrap/js/dist/collapse",
Dropdown: "exports-loader?Dropdown!bootstrap/js/dist/dropdown",
Modal: "exports-loader?Modal!bootstrap/js/dist/modal",
Popover: "exports-loader?Popover!bootstrap/js/dist/popover",
Scrollspy: "exports-loader?Scrollspy!bootstrap/js/dist/scrollspy",
Tab: "exports-loader?Tab!bootstrap/js/dist/tab",
Tooltip: "exports-loader?Tooltip!bootstrap/js/dist/tooltip",
Util: "exports-loader?Util!bootstrap/js/dist/util",
}),
],
};