-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathwebpack.config.js
43 lines (42 loc) · 1.08 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
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']
}
]
}
}