Debian Codegraph @

webpack.config.js

raw ◀ ▶
Source reconstructed at patch state 1 of 2 — not the installed (fully patched) source.
2 Debian patches touch this file
1 const pkg = require('./package.json');
2 const path = require('path');
3 const webpack = require('webpack');
4 const UglifyJSPlugin = require('uglifyjs-webpack-plugin');
5
6 const production = process.env.NODE_ENV === 'production' || false;
7
8 const banner = `clipboard.js v${pkg.version}
9 https://clipboardjs.com/
10
11 Licensed MIT © Zeno Rocha`;
12
13 module.exports = {
14 entry: './src/clipboard.js',
15 mode: 'production',
16 target: ['web', 'es5'],
17 output: {
18 filename: production ? 'clipboard.min.js' : 'clipboard.js',
19 path: path.resolve(__dirname, 'dist'),
20 library: 'ClipboardJS',
21 globalObject: 'this',
22 libraryExport: 'default',
23 libraryTarget: 'umd',
24 },
25 module: {
26 rules: [{ test: /\.js$/, exclude: /node_modules/, loader: 'babel-loader' }],
27 },
28 resolve: {
29 modules: ['/usr/lib/nodejs', '/usr/share/nodejs', 'node_modules'],
30 },
31 resolveLoader: {
32 modules: ['/usr/lib/nodejs', '/usr/share/nodejs'],
33 },
34 optimization: {
35 minimize: production,
36 minimizer: [
37 new UglifyJSPlugin({
38 parallel: require('os').cpus().length,
39 uglifyOptions: {
40 ie8: false,
41 keep_fnames: false,
42 output: {
43 beautify: false,
44 comments: (node, { value, type }) =>
45 type == 'comment2' && value.startsWith('!'),
46 },
47 },
48 }),
49 ],
50 },
51 plugins: [new webpack.BannerPlugin({ banner })],
52 };