-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathwebpack.config.js
58 lines (57 loc) · 1.29 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
require('webpack');
require('weex-loader');
var path = require('path');
var fs = require('fs');
var entry = {};
function walk(dir, root) {
var directory = path.join(__dirname, root, dir)
fs.readdirSync(directory).forEach(function (file) {
var fullpath = path.join(directory, file)
var stat = fs.statSync(fullpath)
// support for vue file
if (stat.isFile() && (path.extname(fullpath) === '.we' || path.extname(fullpath) === '.vue')) {
var name = path.join(dir, path.basename(file, '.we'))
entry[name] = fullpath + '?entry=true'
}
else if (stat.isDirectory()) {
var subdir = path.join(dir, file)
walk(subdir, root)
}
})
}
walk('./', 'src');
module.exports = {
entry: entry
, output: {
path: 'dist'
, filename: '[name].js'
}
, devtool: 'inline-source-map'
, module: {
loaders: [
{
test: /\.we(\?[^?]+)?$/
, loaders: ['weex-loader']
}
, {
test: /\.vue(\?[^?]+)?$/
, loaders: ['vue']
},
{
test: /\.css$/,
use: [
{
loader: 'css-loader',
},
{
loader: 'style-loader'
}
]
},
{
test: /\.(png|jpg|gif|svg|eot|ttf|woff|woff2)$/,
loader: 'url-loader?limit=10240'
},
]
}
}