forked from airyland/vux
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathumd-helper.js
35 lines (31 loc) · 956 Bytes
/
umd-helper.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
'use strict'
const webpack = require('webpack')
const mkdirp = require('mkdirp')
const fs = require('fs')
const touch = require('touch')
const path = require('path')
var co = require('co')
var thunkify = require('thunkify')
var build = thunkify(function (config, name, cb) {
let start = new Date().getTime()
console.log(`start:${name}`)
webpack(config, function (err, stats) {
if (!config.entry.vux) {
mkdirp.sync(path.resolve(config.output.path))
touch.sync(path.resolve(config.output.path, './index.min.css'))
}
var jsonStats = stats.toJson()
var assets = jsonStats.assets[0]
var size = assets.size / 1024
size = size.toFixed(2) + 'k'
console.log('size', size)
console.log('time', (new Date().getTime() - start) / 1000 + 's')
console.log('----------------')
cb && cb(err)
})
})
var ExtractTextPlugin = require('extract-text-webpack-plugin')
module.exports = {
build,
ExtractTextPlugin
}