-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathwebpack.config.js
More file actions
84 lines (81 loc) · 2.35 KB
/
webpack.config.js
File metadata and controls
84 lines (81 loc) · 2.35 KB
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
'use strict';
var webpack = require('webpack');
var path = require('path');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require("extract-text-webpack-plugin");
var CopyWebpackPlugin = require("copy-webpack-plugin");
var CleanWebpackPlugin = require('clean-webpack-plugin');
var APP = path.join(__dirname, '/extension/public/app');
var DIST = path.join(__dirname, '/extension/public/dist');
console.log('APP', APP);
console.log('DIST', DIST);
module.exports = {
context: APP,
entry: {
popup: './popup.index.js',
options: './options.index.js'
},
output: {
path: DIST,
filename: '[name].[hash].js',
publicPath: '/public/dist/'
},
resolve: {
root: APP,
extensions: ["", ".webpack.js", ".web.js", ".js"]
},
module: {
loaders: [
{
test: require.resolve('angular'),
loader: "expose?angular"
},
{
test: /\.js$/,
exclude: [/node_modules/],
loaders: ['ng-annotate']
},
{
test: /\.scss$/,
loader: ExtractTextPlugin.extract("style-loader", "css-loader!resolve-url-loader!sass-loader")
},
{
test: /\.html$/,
loader: 'ngtemplate?relativeTo=' + APP + '/!html',
exclude: path.resolve(APP, 'index.html')
},
{
test: /\.woff(2)?(\?]?.*)?$/,
loader: 'url-loader?limit=10000&mimetype=application/font-woff'
},
{
test: /\.(ttf|eot|svg|png|gif|jpg|jpeg|wav|mp3)(\?]?.*)?$/,
loader: 'file-loader?[path][name].[ext]'
},
{
test: /\.(json)(\?]?.*)?$/,
loader: 'json-loader'
}
]
},
plugins: [
new ExtractTextPlugin("[name].[hash].css", {allChunks: true}),
new HtmlWebpackPlugin({
chunks: ['options'],
template: APP + '/index.html',
filename: 'options.html',
inject: true,
}),
new HtmlWebpackPlugin({
chunks: ['popup'],
template: APP + '/index.html',
filename: 'popup.html',
inject: true,
}),
new CleanWebpackPlugin(['dist'], {
root: path.join(__dirname, '/extension/public/'),
verbose: true,
dry: false
})
]
};