Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathwebpack.config.js
More file actions
Latest commit
126 lines (121 loc) · 4.09 KB
/
Copy pathwebpack.config.js
File metadata and controls
126 lines (121 loc) · 4.09 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
varrupture=require('rupture');
varautoprefixer=require('autoprefixer');
varpath=require('path');
varwebpack=require('webpack');
varExtractTextPlugin=require('extract-text-webpack-plugin');
varHtmlWebpackPlugin=require('html-webpack-plugin');
varip=require("./util").getIPAddress();
varhost=ip||"127.0.0.1";
/*
* babel参数
* */
varbabelQuery={
presets: ['es2015','react','stage-0'],
plugins: ['transform-runtime','add-module-exports','typecheck',"transform-decorators-legacy"],
cacheDirectory: true
};
module.exports={
cache: true,
devtool: 'eval',
entry: [
'webpack-dev-server/client?http://'+host+':3000',
'webpack/hot/only-dev-server',
'./app/App.jsx'
],
output: {
pathinfo: true,
path: path.resolve(__dirname,'public'),
filename: 'bundle.[hash].js',
publicPath: '/'
},
plugins: [
newHtmlWebpackPlugin({
title: 'ReactJS ? I like!',
minify: {
removeAttributeQuotes: true,
collapseInlineTagWhitespace: true,
collapseWhitespace: true,
removeTagWhitespace: true
},
template: './template.html',
inject: 'body'
}),
//Typically you'd have plenty of other plugins here as well
newwebpack.DllReferencePlugin({
context: path.join(__dirname,"app"),
manifest: require("./dll/vendor-manifest.json")
}),
newwebpack.HotModuleReplacementPlugin(),
newExtractTextPlugin('[name].css'),
newwebpack.optimize.UglifyJsPlugin({
compress: {
warnings: false
}
})
],
module: {
loaders: [{
test: /\.styl$/,
exclude: /^node_modules$/,
include: [
// 只去解析运行目录下的 app 文件夹
path.join(__dirname,'app')
],
loader: 'style!css?sourceMap&modules&importLoaders=1&localIdentName=[name]__[local]__[hash:base64:5]!postcss!stylus-loader'
},{
test: /\.css$/,
exclude: /^node_modules$/,
loader: ExtractTextPlugin.extract('style-loader','css-loader!autoprefixer-loader')
},{
test: /\.less/,
exclude: /^node_modules$/,
include: [
// 只去解析运行目录下的 app 文件夹
path.join(__dirname,'app')
],
loader: ExtractTextPlugin.extract('style-loader','css-loader!autoprefixer-loader!less-loader')
},{
test: /\.(eot|woff|svg|ttf|woff2|gif|appcache)(\?|$)/,
exclude: /^node_modules$/,
include: [
// 只去解析运行目录下的 app 文件夹
path.join(__dirname,'./app')
],
loader: 'file-loader?name=[name].[ext]'
},{
test: /.scss$/,
exclude: /node_modules/,
include: [
// 只去解析运行目录下的 app 文件夹
path.join(__dirname,'app')
],
loaders: ["style","css","sass?config=otherSassLoaderConfig"]
},{
test: /\.jsx$/,
exclude: /^node_modules$/,
include: [
// 只去解析运行目录下的 app 文件夹
path.join(__dirname,'app')
],
loaders: ['jsx','babel?presets[]=es2015,presets[]=react']
},{
test: /\.(png|jpg|gif|svg)$/,
exclude: /^node_modules$/,
include: [
// 只去解析运行目录下的 app 文件夹
path.join(__dirname,'app')
],
loader: 'url-loader?name=images/[name].[ext]&limit=8192'
}]
},
resolve: {
root: path.join(__dirname,'app'),
extensions: ['','.js','.jsx','.json','.css','.styl','.png','.jpg','.jpeg','.gif','.svg']
},
stylus: function(){
return[rupture]
},
postcss: function(){
return[autoprefixer];
}
};