-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
46 lines (41 loc) · 1.36 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
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
var CopyWebpackPluginConfig = new CopyWebpackPlugin([
{
from: __dirname + '/src/manifest.json', to: __dirname + '/dist/manifest.json'
},
{
from: __dirname + '/resources/', to: __dirname + "/dist/resources"
}
]);
var PopupHtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: "./src/popup/index.html",
filename: "popup.html",
chunks: [ "popup" ]
})
var SidebarHtmlWebpackPluginConfig = new HtmlWebpackPlugin({
template: "./src/sidebar/index.html",
filename: "sidebar.html",
chunks: ["sidebar"]
})
var ExtractTextPluginConfig = new ExtractTextPlugin("[name].css");
module.exports = {
entry: {
background: './src/background.js',
popup: './src/popup/index.js',
sidebar: './src/sidebar/index.js'
},
output: {
path: __dirname + '/dist',
filename: '[name].js'
},
module: {
loaders: [
{test: /\.js$/, exclude: /node_modules/, loader: "babel-loader"},
{ test: /\.css$/, loader: ExtractTextPlugin.extract(["css-loader"]) },
{test: /\.svg$/, loader: "file-loader"}
]
},
plugins: [CopyWebpackPluginConfig, PopupHtmlWebpackPluginConfig, SidebarHtmlWebpackPluginConfig, ExtractTextPluginConfig]
}