-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathwebpack.config.js
66 lines (64 loc) · 1.63 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
const path = require('path');
const MiniCssExtractPlugin = require('mini-css-extract-plugin');
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const isDevelopment = process.env.NODE_ENV !== 'production';
module.exports = {
mode: isDevelopment ? 'development' : 'production',
entry: {
// Javascripts
'bootstrap': './assets/javascripts/bootstrap.js',
// Stylesheets
'elate/bootstrap': './assets/stylesheets/elate/bootstrap.scss',
'elate/main': './assets/stylesheets/elate/main.scss',
'custom': './assets/stylesheets/custom.scss',
'icomoon': './assets/stylesheets/icomoon.css',
},
output: {
filename: 'javascripts/[name].js',
path: path.resolve(__dirname, 'tmp/dist')
},
module: {
rules: [
{
test: /\.css$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader'
]
},
{
test: /\.scss$/,
use: [
MiniCssExtractPlugin.loader,
'css-loader',
'sass-loader'
]
},
{
test: /\.(ttf|eot|svg|woff)(\?[\s\S]+)?$/,
use: {
loader: 'file-loader',
options: {
name: 'fonts/[folder]/[name]-[hash].[ext]',
publicPath: '..'
}
}
},
]
},
plugins: [
new MiniCssExtractPlugin({
filename: 'stylesheets/[name].css',
chunkFilename: 'stylesheets/[id].css'
}),
new CleanWebpackPlugin({
verbose: true,
protectWebpackAssets: false,
cleanAfterEveryBuildPatterns: [
'javascripts/elate',
'javascripts/custom.js',
'javascripts/icomoon.js',
]
}),
]
};