-
Notifications
You must be signed in to change notification settings - Fork 3
/
webpack.config.js
35 lines (33 loc) · 947 Bytes
/
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
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const GitRevisionPlugin = require('git-revision-webpack-plugin');
const gitRevisionPlugin = new GitRevisionPlugin({branch: true});
const DefinePlugin = require('webpack').DefinePlugin;
const pkg = require('./package.json');
module.exports = {
entry: './src/index.js',
plugins: [
gitRevisionPlugin,
new DefinePlugin({
'VERSION': JSON.stringify(gitRevisionPlugin.version()),
'COMMITHASH': JSON.stringify(gitRevisionPlugin.commithash()),
'BRANCH': JSON.stringify(gitRevisionPlugin.branch())
})
],
output: {
filename: pkg.name + ".v" + pkg.version + '.[git-revision-version].js'
},
module: {
rules: [
{
test: /\.m?js$/,
exclude: /(node_modules|bower_components)/,
use: {
loader: 'babel-loader',
options: {
presets: ['@babel/preset-env']
}
}
}
]
}
}