-
Notifications
You must be signed in to change notification settings - Fork 12
/
webpack.config.dist.js
81 lines (79 loc) · 2.27 KB
/
webpack.config.dist.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
const UglifyJsPlugin = require('uglifyjs-webpack-plugin');
const { getHTMLPlugins, getOutput, getCopyPlugins, getZipPlugin, getFirefoxCopyPlugins, getEntry } = require('./webpack.utils');
const config = require('./config.json');
const CleanWebpackPlugin = require('clean-webpack-plugin');
const generalConfig = {
mode: 'production',
module: {
rules: [
{
loader: 'babel-loader',
exclude: /node_modules/,
test: /\.(js|jsx)$/,
query: {
presets: ['@babel/preset-env','@babel/preset-react'],
},
resolve: {
extensions: ['.js', '.jsx'],
},
},
{
test: /\.(js|jsx)$/,
exclude: /node_modules/,
use: ['eslint-loader'],
},
{
test: /\.scss$/,
use: [
{
loader: 'style-loader',
},
{
loader: 'css-loader',
},
{
loader: 'sass-loader',
},
],
},
],
},
};
module.exports = [
{
...generalConfig,
output: getOutput('chrome', config.tempDirectory),
entry: getEntry(config.chromePath),
plugins: [
new CleanWebpackPlugin(['dist', 'temp']),
new UglifyJsPlugin(),
...getHTMLPlugins('chrome', config.tempDirectory, config.chromePath),
...getCopyPlugins('chrome', config.tempDirectory, config.chromePath),
getZipPlugin('chrome', config.distDirectory),
],
},
{
...generalConfig,
output: getOutput('opera', config.tempDirectory),
entry: getEntry(config.operaPath),
plugins: [
new CleanWebpackPlugin(['dist', 'temp']),
new UglifyJsPlugin(),
...getHTMLPlugins('opera', config.tempDirectory, config.operaPath),
...getCopyPlugins('opera', config.tempDirectory, config.operaPath),
getZipPlugin('opera', config.distDirectory),
],
},
{
...generalConfig,
entry: getEntry(config.firefoxPath),
output: getOutput('firefox', config.tempDirectory),
plugins: [
new CleanWebpackPlugin(['dist', 'temp']),
new UglifyJsPlugin(),
...getHTMLPlugins('firefox', config.tempDirectory, config.firefoxPath),
...getFirefoxCopyPlugins('firefox', config.tempDirectory, config.firefoxPath),
getZipPlugin('firefox', config.distDirectory),
],
},
];