-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwebpack.common.config.js
61 lines (60 loc) · 2.07 KB
/
webpack.common.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
var path = require('path');
module.exports = function(src_path) {
var conf = {
entry: {
vendor: [
'jquery',
'lodash',
'bootstrap-loader'
],
init: './' + src_path + '/init'
},
resolveLoader: {
modulesDirectories: ['node_modules']
},
resolve: {
extensions: ['', '.js', '.jsx', '.css', '.scss'], // ''是用于适配html文件
root: [path.join(__dirname, src_path, 'common')] //
},
postcss: [
require('postcss-modules-local-by-default')
],
module: {
loaders: [{
test: /\.html$/,
exclude: /node_modules/,
loader: 'html'
}, {
test: /\.css$/,
exclude: /node_modules/,
loader: 'style!css'
}, {
test: /\.scss$/,
loaders: [
'style',
'css?importLoaders=1&localIdentName=[name]_[local]_[hash:base64:4]',
'postcss',
'sass?includePaths[]=' + encodeURIComponent(path.resolve(__dirname, "./node_modules/compass-mixins/lib")) + '&includePaths[]=' + encodeURIComponent(path.resolve(__dirname, src_path, 'assets'))
]
}, {
test: /\.(png|jpg|gif)$/,
loader: 'url?limit=800&name=asset/[name].[hash:4].[ext]'
}, {
test: /bootstrap-sass\/assets\/javascripts\//,
loader: 'imports?jQuery=jquery'
}, {
test: /\.(woff2?|ttf|eot|svg)$/,
loader: 'url?limit=10000&name=asset/[name].[hash:4].[ext]',
}, {
test: /\.vue$/,
exclude: /node_modules/,
loader: 'vue'
}, {
test: /\.jsx?$/,
exclude: /node_modules/,
loader: 'babel'
}]
}
}
return conf;
}