-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
47 lines (42 loc) · 1023 Bytes
/
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
'use strict'
const merge = require('lodash.merge')
const buildPlugins = require('./configs/plugin')()
const { urlRelativeOption } = require('./configs/global')
const CleanWebpackPlugin = require('clean-webpack-plugin')
const isProd = process.env.NODE_ENV === 'production'
const loaders = {}
const plugins = []
if (isProd) {
plugins.push(new CleanWebpackPlugin(['dist']))
// 支持资源相对路径
merge(loaders, {
urlimage: {
options: urlRelativeOption('img')
}
})
}
const config = {
framework: 'weex',
port: 9090,
buildPath: 'dist',
publicPath: isProd ? 'dist/' : 'dist/',
alias: {
'@': 'src',
'@views': 'src/views',
'@components': 'src/components',
'@bui': 'node_modules/weex-bui',
'@official': 'src/views/cases/official',
'@xianyu': 'src/views/cases/xianyu',
'@yanxuan': 'src/views/cases/yanxuan'
},
externals: {
light: 'weex'
},
node: {
fs: 'empty'
},
loaders,
plugins,
done () {}
}
module.exports = merge(buildPlugins, config)