-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfis-conf.js
113 lines (102 loc) · 3.18 KB
/
fis-conf.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
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
fis.set('project.ignore',['node_modules/**', 'fis-conf.js','component.json','README.md']);
//fis.set('project.files', 'mod/pages/index/index.html'); // 按需编译
var sModPath = 'client/mods';
fis.unhook('components');
fis.hook('node_modules');
fis.hook('commonjs',{
baseUrl: sModPath,
extList: ['.js', '.jsx', '.es', '.ts', '.tsx']
});
fis.match('/{node_modules,' + sModPath + '}/**.{js,jsx,es}', {
isMod: true
});
fis.match(sModPath + '/**.{js,jsx,es}', {
useSameNameRequire:true
});
fis.match('client/static/(**)',{
release: '/static/$1'
});
fis.match('**.scss', {
rExt: '.css',
parser: fis.plugin('node-sass', {
})
});
// 编译所有后缀为 jsx 的文件为 js
fis.match('{*.jsx,*:jsx,*.es}', {
parser: fis.plugin('babel-5.x', {
sourceMaps: true
}),
rExt: '.js'
});
// 添加css和image加载支持
fis.match('*.{js,jsx,ts,tsx,es}', {
preprocessor: [
fis.plugin('js-require-css'),
fis.plugin('js-require-file', {
useEmbedWhenSizeLessThan: 3 * 1024 // 小于3k用base64
})
]
});
fis.match(sModPath + "/pages/index/(*.html)",{
release: '/$1',
useCache : false
});
fis.match('::package', {
postpackager: fis.plugin('loader',{
resourceType: 'mod',
useInlineMap: true
})
});
fis.media('prod')
.match('**.{css,scss}', {
optimizer: fis.plugin('clean-css'),
useHash:true,
useSprite:true
})
.match('**.{js,es,jsx}',{
optimizer: fis.plugin('uglify-js'),
useHash:true
})
.match(/\.png$/i, {
optimizer: fis.plugin('png-compressor')
})
.match('node_modules/**',{
useHash: false
})
.match('::package', {
packager: fis.plugin('deps-pack', {
'pkg/vue.all.js':[
"node_modules/vue/dist/vue.common.js",
"node_modules/vuex/dist/vuex.js",
"node_modules/vue-router/dist/vue-router.js",
"node_modules/vuex-router-sync/index.js",
],
'pkg/npm.js': [
sModPath + '/pages/index/index.es:deps',
sModPath + '/pages/trend/trend.es:deps',
sModPath + '/pages/atricle/atricle.es:deps',
'!' + sModPath + '/**'
],
'pkg/index.js': [
sModPath + '/pages/index/index.es',
sModPath + '/pages/index/index.es:deps'
],
'pkg/index.css': [
sModPath + '/pages/index/index.es:deps'
],
'pkg/trend.js': [
sModPath + '/pages/trend/trend.es',
sModPath + '/pages/trend/trend.es:deps'
],
'pkg/trend.css': [
sModPath + '/pages/trend/trend.es:deps'
],
'pkg/article.js': [
sModPath + '/pages/article/article.es',
sModPath + '/pages/article/article.es:deps'
],
'pkg/article.css': [
sModPath + '/pages/article/article.es:deps'
]
})
});