forked from clockify/browser-extension
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
55 lines (53 loc) · 1.61 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
const path = require('path');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const webpack = require('webpack');
const serviceVersion = require("./package.json").version;
const DEV = !process.env.NODE_ENV || process.env.NODE_ENV !== 'prod';
module.exports = env => { return {
entry: [
'babel-polyfill', './src/main.js'
],
output: {
path: path.join(__dirname, `www/${env.TARGET}`),
filename: '[name].bundle.js',
},
optimization: {
minimize: DEV ? false : true,
splitChunks: {
chunks: "all",
automaticNameDelimiter: "."
}
},
module: {
rules: [
{
test: /\.js$/,
exclude: /node_modules/,
use: [
'babel-loader',
],
},
],
},
resolve: {
modules: [
path.join(__dirname, 'node_modules'),
],
},
plugins: [
new webpack.EnvironmentPlugin({
NODE_ENV: 'local'
}),
new CopyWebpackPlugin([
{from: './assets', to: './assets'},
{from: './styles', to: './styles'},
{from: `./index.html`, to: './'},
{from: `./manifest.${env.TARGET}.json`, to: `./manifest.json`},
{from: './src/contentScripts', to: './contentScripts'},
{from: './src/integrations', to: './integrations'},
{from: './src/settings.html', to: './'},
{from: './src/settings.js', to: './'}
]),
new webpack.DefinePlugin({'serviceVersion': JSON.stringify(serviceVersion)})
]
}; };