forked from trazyn/weweChat
-
Notifications
You must be signed in to change notification settings - Fork 0
/
webpack.config.base.js
92 lines (86 loc) · 3.19 KB
/
webpack.config.base.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
82
83
84
85
86
87
88
89
90
91
92
import path from 'path';
import config from './index';
export default {
module: {
loaders: [
{
test: /\.jsx?$/,
loader: 'babel-loader',
exclude: /node_modules/
},
{
test: /\.css$/,
use: [
'style-loader',
{
loader: 'css-loader',
options: {
// Note that we’ve set importLoaders: 1 on css-loader.
// We’re setting this because we want PostCSS to git @import statements first
importLoaders: 1,
localIdentName: '[path][name]__[local]--[hash:base64:5]'
},
},
{
loader: 'postcss-loader',
options: {
plugins: (loader) => [
require('postcss-import')(),
require('postcss-autoreset')(),
require('postcss-cssnext')({
browsers: [
'last 2 Chrome versions',
'last 2 Edge versions',
'last 2 Safari versions',
'last 2 Firefox versions',
],
}),
]
}
}
],
},
{
test: /\.json$/,
loader: 'json-loader',
},
{
test: /\.woff(\?.*)?$/,
loader: 'url-loader?prefix=fonts/&name=[path][name].[ext]&limit=40000&mimetype=application/font-woff',
},
{
test: /\.woff2(\?.*)?$/,
loader: 'url-loader?prefix=fonts/&name=[path][name].[ext]&limit=40000&mimetype=application/font-woff2',
},
{
test: /\.otf(\?.*)?$/,
loader: 'file-loader?prefix=fonts/&name=[path][name].[ext]&limit=40000&mimetype=font/opentype',
},
{
test: /\.ttf(\?.*)?$/,
loader: 'url-loader?prefix=fonts/&name=[path][name].[ext]&limit=40000&mimetype=application/octet-stream',
},
{
test: /\.eot(\?.*)?$/,
loader: 'file-loader?prefix=fonts/&name=[path][name].[ext]',
},
{
test: /\.svg(\?.*)?$/,
loader: 'url-loader?prefix=fonts/&name=[path][name].[ext]&limit=40000&mimetype=image/svg+xml',
},
]
},
output: {
path: config.dist,
filename: 'bundle.js',
// https://github.com/webpack/webpack/issues/1114
libraryTarget: 'commonjs2'
},
resolve: {
extensions: ['.js', '.jsx', '.json'],
alias: {
images: path.join(config.client, 'assets/images/'),
fonts: path.join(config.client, 'assets/fonts/'),
},
},
};