-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.prod.config.js
43 lines (42 loc) · 1.23 KB
/
webpack.prod.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
/**
* webpack config to build the public module.
* Devdeps in outer repo.
*
* Copyright (c) 2017-2025 Alex Grant (@localnerve), LocalNerve LLC
* Copyrights licensed under the BSD License. See the accompanying LICENSE file for terms.
*/
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const webpack = require('webpack');
const TerserPlugin = require('terser-webpack-plugin');
const pkg = require('./package.json');
module.exports = {
mode: 'production',
entry: path.join(__dirname, 'horizontal-pager.js'),
optimization: {
minimizer: [new TerserPlugin({ extractComments: false })],
},
output: {
path: path.resolve(__dirname, 'dist'),
filename: 'index.js',
library: 'horizontalPager',
libraryTarget: 'umd'
},
module: {
rules: [{
test: /\.js$/,
loader: 'babel-loader'
}]
},
plugins: [
new webpack.DefinePlugin({
'process.env': {
NODE_ENV: JSON.stringify('production')
}
}),
new webpack.BannerPlugin({
banner: `horizontal-pager@${pkg.version}, Copyright (c) 2017-${(new Date()).getFullYear()} Alex Grant <[email protected]> (https://www.localnerve.com), LocalNerve LLC, BSD-3-Clause`,
entryOnly: true
})
]
};