-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
47 lines (46 loc) · 1.18 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
const path = require('path');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
const HtmlWebpackPlugin = require('html-webpack-plugin');
const CopyWebpackPlugin = require('copy-webpack-plugin');
module.exports = {
entry: {
popup: './src/popup.js',
background: './src/background.js',
},
output: {
path: path.resolve('build'),
filename: '[name].js'
},
module: {
loaders: [
{
test: /\.js$/,
loader: 'babel-loader',
include: path.resolve('src'),
exclude: /node_modules/
},
{
test: /\.less$/,
use: ExtractTextPlugin.extract({
fallback: 'style-loader',
use: ['css-loader', 'less-loader']
})
}
]
},
plugins: [
new ExtractTextPlugin("[name].css"),
// create popup.html from template and inject styles and script bundles
new HtmlWebpackPlugin({
inject: true,
chunks: ['popup'],
filename: 'popup.html',
template: './src/popup.html'
}),
// copy extension manifest and icons
new CopyWebpackPlugin([
{ from: './src/manifest.json' },
{ context: './src/assets', from: 'icon-**', to: 'assets' }
])
]
};