-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathwebpack.config.js
82 lines (77 loc) · 2.66 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
75
76
77
78
79
80
81
var webpack = require('webpack');
var path = require('path');
var NodeModules = path.resolve(__dirname, "./node_modules");
var config = {
//devtool: "source-map",
entry: {
index: ['./src/index.jsx']
},
output: {
publicPath: "/assets/",
path: path.join(__dirname, '/public/assets'),
filename: '[name].js?[hash]',
chunkFilename: "[id].bundle.js?[hash]"
},
resolve: {
extensions:['','.js','.json','.jsx','.css','.es6','.scss','.png','.jpg','.jpeg'],
alias: {
'antd': path.join(NodeModules, "/antd"),
'app': path.resolve(__dirname, "./src")
}
},
module: {
noParse: [
path.join(NodeModules, "/react/dist/react"),
],
//{
// test: /\.jsx?$/,
// loader: 'es3ify',
//},
loaders:[
{
test : /\.(js|jsx)$/,
exclude: /node_modules/,
loader: 'babel',
include: path.join(__dirname, 'src'),
query:{
"presets": ["es2015", "react", "stage-0"],
"plugins":[
"transform-decorators-legacy",
//"transform-es2015-modules-commonjs",
"add-module-exports",["antd"]]
}
//loaders: ['react-hot','babel?presets[]=es2015&presets[]=react&presets[]=stage-0&plugins[]=transform-decorators-legacy']
},
{
test: /\.less$/,
loader: 'style-loader!css-loader!autoprefixer-loader!less-loader'
},
{ test: /\.css$/, loader: 'style-loader!css-loader?localIdentName=[hash:base64:8]' },
{ test: /\.(ttf|eot|woff|woff2|otf|svg)/, loader: 'file-loader?name=./font/[name].[ext]' },
{ test: /\.json$/, loader: 'file-loader?name=./json/[name].json' },
{ test: /\.(png|jpg|jpeg|gif)$/, loader: 'url-loader?limit=10000&name=./images/[name].[ext]' }
]
},
externals: {
//'react': 'React',
//'react-dom': 'ReactDOM',
},
plugins: [
//new webpack.optimize.CommonsChunkPlugin('vendors', 'vendors.js'),
new webpack.ProvidePlugin({
"React": "react",
"ReactDOM": "react-dom"
}),
//new webpack.DefinePlugin({
// 'process.env.NODE_ENV': '"production"'
//}),
new webpack.optimize.OccurenceOrderPlugin(),
//new webpack.optimize.UglifyJsPlugin({
// compress: {
// warnings: false
// }
//}),
new webpack.NoErrorsPlugin()
]
};
module.exports = config;