This repository has been archived by the owner on Apr 24, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 17
/
webpack.config.js
77 lines (72 loc) · 1.79 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
const path = require('path');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
module.exports = {
context: __dirname + "/src",
entry: ['./bootstrap-theme.js', './styles/bootstrap-theme.scss'],
output: {
path: __dirname + "/dist",
publicPath: '../',
filename: 'js/bootstrap-theme.min.js'
},
module: {
rules: [
// loader for regular css files
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { sourceMap: true, importLoaders: 1 } },
'postcss-loader',
],
},
// scss loader for webpack
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
{ loader: 'css-loader', options: { sourceMap: true, importLoaders: 1 } },
{ loader: 'sass-loader', options: { sourceMap: true } },
],
},
// move fonts into local directory
{
test: /\.(otf|ttf|eot|woff|woff2|svg)$/,
use: [
{
loader: 'file-loader',
options: {
name: '[path][name].[ext]',
debug: true
}
}
]
}
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'css/bootstrap-theme.min.css',
}),
// We just copy these because the client may have already a dependency or choose a different JS package
new CopyWebpackPlugin([
{
from: 'fonts',
to: 'fonts'
},
{
from: 'images',
to: 'images'
},
{
from: 'styles',
to: 'scss'
}
]),
new CleanWebpackPlugin({
verbose: true,
dry: false
}),
],
};