-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.config.js
57 lines (56 loc) · 1.38 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
var path = require('path');
var CleanWebpackPlugin = require('clean-webpack-plugin');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var HtmlWebpackPlugin = require('html-webpack-plugin');
var ExtractTextPlugin = require('extract-text-webpack-plugin');
module.exports = {
context: path.join(__dirname,'src'),
entry: {
main: './js/main.js',
ui: './js/ui.js',
},
resolve: {
fallback: [
path.join(__dirname,'src'),
path.join(__dirname,'src/js'),
],
},
output: {
path: path.join(__dirname,'extension'),
filename: '[name].js',
},
module: {
loaders: [
{
test: /.jsx?$/,
exclude: /node_modules/,
loader: 'babel-loader',
query: {
presets: ['es2015', 'react'],
},
},
{
test: /\.less$/,
loader: ExtractTextPlugin.extract('css?sourceMap!less?sourceMap'),
},
{
test: /\.css$/,
loader: ExtractTextPlugin.extract('style-loader', 'css-loader'),
},
],
},
plugins: [
new ExtractTextPlugin('[name].css'),
new CleanWebpackPlugin(['extension']),
new CopyWebpackPlugin([
{ from: 'html' },
{ from: 'manifest.json' },
{ from: 'img/linux-sunxi.org-155x155.png', to: 'icon155.png' },
]),
new HtmlWebpackPlugin({
filename: 'ui.html',
template: 'html/ui.html',
chunks: ['ui'],
}),
],
};