forked from AdamNowotny/BuildReactor
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.js
113 lines (107 loc) · 2.95 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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
/* eslint-env node */
const path = require("path");
const webpack = require("webpack");
const WebpackErrorNotificationPlugin = require('webpack-error-notification');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
context: path.join(__dirname, "src"),
entry: {
background: "./core/main.js",
popup: "./popup/main.js",
settings: "./settings/main.js",
dashboard: "./dashboard/main.js"
},
output: {
publicPath: './',
path: path.join(__dirname, "dist/BuildReactor"),
filename: "[name].js",
chunkFilename: "[id].chunk.js"
},
resolve: {
modulesDirectories: ["node_modules", "node_modules/rx/dist"],
extensions: ['', '.js'],
root: path.join(__dirname, "src")
},
plugins: [
new WebpackErrorNotificationPlugin(/* strategy */),
new HtmlWebpackPlugin({
template: 'settings/index.html',
filename: 'settings.html',
inject: 'body',
chunks: ['commons', 'settings'],
minify: false
}),
new HtmlWebpackPlugin({
template: 'popup/index.html',
filename: 'popup.html',
inject: 'body',
chunks: ['commons', 'popup'],
minify: false
}),
new HtmlWebpackPlugin({
template: 'dashboard/index.html',
filename: 'dashboard.html',
inject: 'body',
chunks: ['commons', 'dashboard'],
minify: false
}),
new webpack.optimize.CommonsChunkPlugin({
name: "commons",
filename: "commons.js",
minChunks: 3, // Modules must be shared between 3 entries
chunks: ["settings", "dashboard", "popup"]
}),
new CopyWebpackPlugin([
{ from: '../manifest.json' },
{ from: '../img', to: 'img' },
{ from: 'core/services/*/*.png' }
]),
new ExtractTextPlugin("[name].css")
],
module: {
loaders: [
{
test: /\.js$/,
include: path.join(__dirname, 'src'),
loader: 'babel-loader',
query: {
presets: ["es2015"]
}
},
{
test: /\.?css$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!sass-loader")
},
{
test: /\.(png|jpg)$/,
loader: "url?limit=10000&name=/img/[name].[ext]"
},
{
test: /\.(svg)/,
loader: 'url?limit=10000&name=/img/[name].[ext]'
},
{
test: /\.(ttf|eot|otf|woff|woff2)(\?v=[0-9]\.[0-9]\.[0-9])?$/,
loader: "file?name=/fonts/[name].[ext]"
},
{
test: /\.html$/,
exclude: /index\.html$/,
loader: `ngtemplate?relativeTo=${path.resolve(__dirname, 'src')}/!html`
},
{
test: /jquery\.js$/,
loader: 'expose?$!expose?jQuery'
},
{
test: /(angular-mocks|angular-route|angular-ui-bootstrap|angular-ui-utils)/,
loader: 'imports?angular'
}
]
},
devServer: {
contentBase: "./src"
}
};