-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
66 lines (62 loc) · 1.26 KB
/
index.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
59
60
61
62
63
64
65
66
const {resolve} = require('path')
/**
*
* vayne angularjs 插件
* @class VaynePluginAngular
*/
class VaynePluginAngular {
constructor(config, log) {
log.debug('开始解析 vayne angularjs插件')
// 标识插件 name
this.name = 'VaynePluginAngular'
return {
loaders: this.init(config)
}
}
initJsLoader(config) {
return {
test: /\.js$/,
use: [
{
loader: 'ng-annotate-loader',
options: {
ngAnnotate: 'ng-annotate-patched',
es6: true,
explicitOnly: false
}
},
{
loader: 'babel-loader'
}
],
include: config.include
}
}
initTempLoader(config) {
return {
test: /\.(htm|html)$/,
use: [
{
loader: 'ngtemplate-loader',
options: {
relativeTo: resolve(config.appDirectory, '/src/')
}
},
{
loader: 'html-loader',
options: {
minimize: !config.build.productionSourceMap,
attrs: ['img:data-src', 'img:src']
}
}
]
}
}
init(config) {
return [
this.initJsLoader(config),
this.initTempLoader(config)
]
}
}
module.exports = VaynePluginAngular