-
Notifications
You must be signed in to change notification settings - Fork 95
/
webpack.config.js
31 lines (27 loc) · 1021 Bytes
/
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
// Whilst the configuration object can be modified here, the recommended way of making
// changes is via the presets' options or Neutrino's API in `.neutrinorc.js` instead.
// Neutrino's inspect feature can be used to view/export the generated configuration.
const path = require('path');
const neutrino = require('neutrino');
const CopyPlugin = require('copy-webpack-plugin');
const basicConfig = neutrino().webpack();
const generateConfig = (config, browser) => {
const { output, plugins } = config;
return {
...config,
output: {
...output,
path: path.resolve(__dirname, `./builds/build_${browser}`),
},
plugins: [
...plugins,
new CopyPlugin([
{ from: `./${browser}.manifest.json`, to: './manifest.json' },
{ from: `./${browser}.background.js`, to: './background.js' },
]),
],
};
};
const chromeConfig = generateConfig(basicConfig, 'chrome');
const ffConfig = generateConfig(basicConfig, 'firefox');
module.exports = [chromeConfig, ffConfig];