-
Notifications
You must be signed in to change notification settings - Fork 410
/
webpack.config.js
74 lines (73 loc) · 2.16 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
var webpack = require('webpack');
var CopyWebpackPlugin = require('copy-webpack-plugin');
var path = require('path');
// var commonsPlugin = new webpack.optimize.CommonsChunkPlugin('common.js');
module.exports = {
//插件项
// plugins: [commonsPlugin],
//页面入口文件配置
entry: {
index : './src/js/index.js'
},
//入口文件输出配置
output: {
path: 'docs/js/',
filename: '[name].js'
},
module: {
//加载器配置
loaders: [
{ test: /\.css$/, loader: 'style-loader!css-loader' },
{ test: /\.js$/, loader: 'jsx-loader?harmony' },
{ test: /\.less$/, loader: 'style-loader!css-loader!less-loader?sourceMap'},
{ test: /\.(png|jpg)$/, loader: 'url-loader?limit=8192'}
]
},
plugins: [
new CopyWebpackPlugin([
{
context: path.join(__dirname, './src/css/pageThemes'),
from: '*',
to: '../pageThemes',
force: true
},
{
context: path.join(__dirname, './src/imgs'),
from: '*',
to: '../imgs',
force: true
},
{
context: path.join(__dirname, './src/css/themes'),
from: '*',
to: '../themes',
force: true
},
{
context: path.join(__dirname, './src'),
from: "index.html",
to: '../index.html',
force: true
},
{
context: path.join(__dirname, './src'),
from: "demo.md",
to: '../demo.md',
force: true
},
{
context: path.join(__dirname, './src'),
from: "favicon.ico",
to: '../favicon.ico',
force: true
},
{
context: path.join(__dirname, './src'),
from: "CNAME",
to: '../CNAME',
toType: 'file',
force: true
}
])
]
};