-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathwebpack.config.js
73 lines (71 loc) · 1.69 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
const path =require('path');
const existsSync = require('fs').existsSync;
var webpack = require('webpack');
var node_modules_dir = path.resolve(__dirname, 'node_modules');
const ExtractTextPlugin = require('extract-text-webpack-plugin');
var pathToReact = path.resolve(node_modules_dir, 'react/dist/react.min.js');
const extractLESS = new ExtractTextPlugin('./../css/[name].css');
const config = {
entry: {
index:path.resolve(__dirname, './src/index.js'),
vendors: ['react']
},
output: {
path: path.resolve(__dirname, './dist/js/'),
publicPath: path.resolve(__dirname, '/dist/js/'),
filename: '[name].js'
},
module: {
loaders: [
{
test:/\.jsx?$/,
loader:'babel-loader',
exclude: [
path.resolve(__dirname,node_modules_dir)
]
},
{
test:/\.css$/,
loader:'style-loader!css-loader!postcss-loader'
},
{
test:/\.less$/i,
use: extractLESS.extract({
fallback: 'style-loader',
use:['css-loader','postcss-loader','less-loader' ]
})
},
{
test:/\.scss$/,
loader:'style-loader!css-loader!postcss-loader!sass-loader'
},
{
test: /\.(png|jpg|gif|woff|woff2)$/,
loader: 'url-loader?limit=8192'
},
{
test: /\.(mp4|ogg|svg)$/,
loader: 'file-loader'
},
],
noParse: [
/$react.min\.js/,
/react-dom.min\.js$/,
/react-router.min\.js$/,
/antd.min\.js$/,
/antd-mobile.min\.js$/,
]
},
plugins: [
new webpack.optimize.CommonsChunkPlugin({
name: 'vendors',
filename: 'vendor.bundle.js'
}),
require('autoprefixer'),
extractLESS
],
resolve: {
extensions: ['.web.tsx', '.web.ts', '.web.jsx', '.web.js', '.ts', '.tsx', '.js', '.jsx', '.json'],
}
}
module.exports = config;