forked from JetBrains/toolbox-browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
104 lines (101 loc) · 3.08 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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
/* eslint-env node */
/* eslint-disable import/no-commonjs */
const path = require('path');
const TerserPlugin = require('terser-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const LicenseChecker = require('@jetbrains/ring-ui-license-checker');
module.exports = {
entry: {
'github-public': './github-public',
'gitlab-public': './gitlab-public',
'bitbucket-public': './bitbucket-public',
background: './background',
'clone-popup': './popups/clone',
'detect-enterprise': './detect-enterprise',
options: './pages/options'
},
output: {
filename: 'jetbrains-toolbox-[name].js',
path: path.resolve(__dirname, 'dist')
},
module: {
rules: [
{
test: require.resolve('whatwg-fetch'),
loader: 'imports-loader?Promise=core-js/es6/promise'
},
{
test: /\.js$/,
loader: 'babel-loader',
options: {
babelrc: false,
presets: [
[
require('@babel/preset-env')
]
]
}
},
{
test: /\.(svg|png)$/,
loader: 'file-loader?name=[name].[ext]'
}
]
},
optimization: {
minimizer: [
new TerserPlugin({
extractComments: false,
terserOptions: {
extractComments: false,
mangle: false,
compress: {
defaults: false,
unused: true,
arguments: true,
booleans: false,
expression: false,
sequences: false,
/* eslint-disable camelcase */
dead_code: true,
join_vars: false,
keep_classnames: true,
keep_fnames: true
/* eslint-enable camelcase */
},
output: {
beautify: true,
comments: false,
/* eslint-disable camelcase */
indent_level: 2
/* eslint-enable camelcase */
}
}
})
]
},
plugins: [
new CopyWebpackPlugin({
patterns: [
{from: 'manifest.json'},
{from: 'icons/icon-128.png', to: 'icon-128.png'}, // Replace with logo from package after it's generation
{from: 'icons/icon-disabled-128.png', to: 'icon-disabled-128.png'},
{from: 'popups/clone.html', to: 'jetbrains-toolbox-clone-popup.html'},
{from: 'popups/disabled.html', to: 'jetbrains-toolbox-disabled-popup.html'},
{from: 'pages/options-extra-buttons.png', to: 'options-extra-buttons.png'},
{from: 'pages/options.html', to: 'options.html'},
{from: 'pages/options.css', to: 'options.css'},
{from: 'styles/common.css', to: 'common.css'},
{from: 'styles/page.css', to: 'page.css'},
{from: 'styles/popup.css', to: 'popup.css'},
{from: 'styles/variables.css', to: 'variables.css'}
]
}),
new LicenseChecker({
format: params => params.modules.map(mod => `${mod.name}@${mod.version} (${mod.url})
${mod.license.name} (${mod.license.url})`).join('\n\n'),
filename: 'third-party-licences.txt',
exclude: /@jetbrains[\/|\\]logos/
})
]
};