This repository has been archived by the owner on Oct 28, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.firefox.js
66 lines (53 loc) · 1.69 KB
/
webpack.firefox.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
const CleanWebpackPlugin = require('clean-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const path = require('path');
const getDistPath = require('./builder/getDistPath');
const RemoveAssets = require('./builder/removeAssets');
const mode = BUILD_ENV.mode;
const sourcePath = BUILD_ENV.sourcePath;
const outputPath = BUILD_ENV.outputPath;
const distPath = getDistPath();
const config = {
entry: {
empty: './builder/noop',
},
output: {
path: outputPath,
filename: 'empty.point'
},
mode: mode,
devtool: 'none',
plugins: [
new CleanWebpackPlugin([
outputPath
]),
new CopyWebpackPlugin([
{
from: path.join(sourcePath, './manifest.json'),
to: path.join(distPath, './manifest.json'),
transform: (content, path) => {
const manifest = JSON.parse(content);
manifest.version = BUILD_ENV.version;
manifest.applications = {
gecko: {
id: BUILD_ENV.geckoId,
strict_min_version: '48.0'
}
};
manifest.options_ui = {};
manifest.options_ui.page = manifest.options_page;
manifest.options_ui.open_in_tab = true;
delete manifest.options_page;
delete manifest.background.persistent;
delete manifest.update_url;
delete manifest.minimum_chrome_version;
return JSON.stringify(manifest, null, 4);
}
},
{from: path.join(sourcePath, './icons'), to: path.join(distPath, './icons')},
{from: path.join(sourcePath, './_locales'), to: path.join(distPath, './_locales')},
]),
new RemoveAssets(['empty.point']),
],
};
module.exports = config;