-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
98 lines (96 loc) · 3.22 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
const distDir = __dirname + '/themes/bootstrap_framework';
const fs = require('fs');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const webpack = require('webpack');
module.exports = {
mode: 'production',
entry: [
'./js/app.js',
'./scss/app.scss',
],
output: {
path: distDir,
filename: 'assets/js/[name].js'
},
performance: {
hints: false
},
optimization: {
minimize: true
},
plugins: [
new CleanWebpackPlugin(),
new MiniCssExtractPlugin({
filename: 'assets/css/main.css'
}),
new webpack.ProvidePlugin({
Popper: ['popper.js', 'default'],
// Bootstrap scripts.
//Util: 'exports-loader?Util!bootstrap/js/dist/util',
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',
Toast: 'exports-loader?Toast!bootstrap/js/dist/toast',
Tooltip: 'exports-loader?Tooltip!bootstrap/js/dist/tooltip'
}),
new CopyWebpackPlugin({
patterns: [
{
context: 'templates',
from: '**/*',
},
],
}),
],
module: {
rules: [
{
test: /\.jsx?$/,
exclude: /node_modules/,
use: ['babel-loader'],
},
{
test: /\.(scss)$/,
use: [
MiniCssExtractPlugin.loader,
{
loader: 'css-loader', options: { importLoaders: 2 },
},
{
loader: 'postcss-loader',
options: {
plugins: [require('autoprefixer')],
},
},
{
loader: 'sass-loader',
options: {
implementation: require('sass'),
sassOptions: {
outputStyle: 'expanded',
},
},
},
],
},
// Bundle WOFF fonts and SVGs if provided.
{
test: /\.(woff(2)?|svg)$/,
type: 'asset/inline',
},
// Bundle images if provided.
{
test: /\.(?:ico|gif|jpe?g|png|svg|webp)$/i,
type: 'asset/resource',
},
],
},
};