forked from Klimaat-Helpdesk/website
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
executable file
·61 lines (58 loc) · 1.73 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
// webpack v4
const path = require('path');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const WebpackMd5Hash = require('webpack-md5-hash');
const MiniCssExtractPlugin = require("mini-css-extract-plugin"); // not needed, only to split them up
const { CleanWebpackPlugin } = require('clean-webpack-plugin');
const BundleTracker = require('webpack-bundle-tracker');
const forProduction = process.argv.indexOf('-p') > -1;
const baseName = forProduction ? '[name]-[hash].min.[ext]' : '[name].[ext]';
module.exports = {
entry: { main: './klimaat_helpdesk/static/index.js' },
output: {
path: path.resolve('assets/bundles/'),
filename: baseName.replace(/\[ext]/i, 'js')
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: "babel-loader"
}
},
{
test: /\.s[c|a]ss$/,
use: ['style-loader', MiniCssExtractPlugin.loader, 'css-loader', 'postcss-loader', 'sass-loader']
},
]
},
resolve: {
modules: [
'../node_modules',
'./klimaat_helpdesk/static/stylesheets',
'./klimaat_helpdesk/static/scripts',
],
extensions: ['.js', '.scss'], // ,
},
plugins: [
new CleanWebpackPlugin({ cleanOnceBeforeBuildPatterns: [ 'build' ]}), // Remove/clean build folders
new MiniCssExtractPlugin({
// filename: 'style.[contenthash].css',
filename: 'style.css',
}),
new BundleTracker({
filename: 'webpack-stats.json',
path: process.cwd(),
})
// new ExtractTextPlugin({filename:'app.bundle.css'}),
// new HtmlWebpackPlugin({
// inject: false,
// hash: true,
// template: './index.html',
// filename: 'index.html'
// }),
// new WebpackMd5Hash()
]
};