-
Notifications
You must be signed in to change notification settings - Fork 12
/
Copy pathcompile.js
26 lines (23 loc) · 842 Bytes
/
compile.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
/**
* Created by liekkas on 16/4/1.
*/
import webpack from 'webpack'
import webpackConfig from './webpack.config'
const compiler = webpack(webpackConfig)
console.log('>>> prodCompile:Create webpack compiler.')
compiler.run(function (err, stats) {
const jsonStats = stats.toJson()
console.log('>>> prodCompile:Webpack compile completed.')
if (err) {
console.log('>>> prodCompile:Webpack compiler encountered a fatal error.', err)
process.exit(1)
} else if (jsonStats.errors.length > 0) {
console.log('>>> prodCompile:Webpack compiler encountered errors.')
console.log(jsonStats.errors)
process.exit(1)
} else if (jsonStats.warnings.length > 0) {
console.log('>>> prodCompile:Webpack compiler encountered warnings.')
} else {
console.log('>>> prodCompile:No errors or warnings encountered.')
}
})