-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
68 lines (67 loc) · 1.74 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
const webpack = require("webpack");
const TerserPlugin = require('terser-webpack-plugin');
const WebpackShellPluginNext = require('webpack-shell-plugin-next');
module.exports = {
devtool: 'source-map',
entry: {
jquery: [
'./assets/js/_main.js',
'./assets/js/plugins/jquery.fitvids.js',
'./assets/js/plugins/jquery.greedy-navigation.js'
],
dragAndDrop: './src/drag-and-drop.js',
blossom: './src/blossom.js',
},
output: {
filename: '[name].bundle.min.js',
},
resolve: {
fallback: {
path: require.resolve('path-browserify'),
fs: false, // 'fs' is not supported in browsers, disable it
zlib: require.resolve('browserify-zlib'),
util: require.resolve('util/'),
stream: require.resolve('stream-browserify'),
assert: require.resolve('assert'),
process: require.resolve('process/browser'),
},
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
},
optimization: {
minimize: true,
minimizer: [new TerserPlugin({
extractComments: false,
})],
},
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
'window.$': 'jquery',
process: 'process/browser',
}),
new WebpackShellPluginNext({
onBuildStart: {
scripts: [
'printf "last_commit_ref: %s\\n" "$(git rev-parse HEAD)" > ./_data/git.yml',
'printf "uncommited: %s\\n" "$(git status -s -b | tr \'\\n\' \'*\' | tr \'##\' \' \')" >> ./_data/git.yml'
],
blocking: true
}
})
]
};