-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
90 lines (89 loc) · 2.39 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
/* eslint-disable */
const path = require('path');
const fs = require('fs');
const webpack = require('webpack');
const CopyWebpackPlugin = require('copy-webpack-plugin');
const isProduction = typeof process.env.PRODUCTION !== 'undefined';
console.log((isProduction ? 'Production' : 'Test') + ' build ...');
const distPath = isProduction ? './dist/compiled/' : './dist/chrome/';
module.exports = {
devtool: isProduction ? 'nosources-source-map' : 'cheap-module-source-map',
entry: {
'voz-living': './app/bootstrap.js',
'background': './background/bootstrap.js',
'options': './options/root.js',
},
output: {
path: path.join(__dirname, distPath),
filename: '[name].js'
},
module: {
rules: [
{
test: /\.less$/,
use: [{
loader: "style-loader" // creates style nodes from JS strings
}, {
loader: "css-loader" // translates CSS into CommonJS
}, {
loader: "less-loader" // compiles Less to CSS
}]
},
{
test: /\.jsx$|\.js$/,
exclude: /node_modules/,
use: [
{ loader: 'babel-loader' }
],
},
]
},
resolve: {
modules: [
path.resolve('./app'),
path.resolve('./node_modules')
],
extensions: ['.js', '.json']
},
plugins: [
new webpack.DllReferencePlugin({
context: '.',
manifest: require(distPath + 'common-manifest.json')
}),
new webpack.DllReferencePlugin({
context: '.',
manifest: require(distPath + 'content-manifest.json')
}),
new CopyWebpackPlugin([
{
from: path.join(__dirname, './manifest.json'),
to: 'manifest.json'
},
{
from: path.join(__dirname, './assert'),
to: './assert'
},
{
from: path.join(__dirname, './options/options.html'),
to: './options.html'
},
{
from: path.join(__dirname, './background/background.html'),
to: './background.html'
},
{
from: path.join(__dirname, './edge_components/backgroundScriptsAPIBridge.js'),
to: 'backgroundScriptsAPIBridge.js'
},
{
from: path.join(__dirname, './edge_components/contentScriptsAPIBridge.js'),
to: 'contentScriptsAPIBridge.js'
},
]),
].concat(isProduction ? [
new webpack.optimize.UglifyJsPlugin({
beautify: false,
comments: false,
}),
]: [])
};