@@ -22,19 +22,27 @@ const weexFactoryPlugin = {
22
22
}
23
23
}
24
24
25
- const resolve = p => path . resolve ( __dirname , '../' + p )
25
+ const aliases = require ( './alias' )
26
+ const resolve = p => {
27
+ const base = p . split ( '/' ) [ 0 ]
28
+ if ( aliases [ base ] ) {
29
+ return path . resolve ( aliases [ base ] , p . slice ( base . length + 1 ) )
30
+ } else {
31
+ return path . resolve ( __dirname , '../' , p )
32
+ }
33
+ }
26
34
27
35
const builds = {
28
36
// Runtime only (CommonJS). Used by bundlers e.g. Webpack & Browserify
29
37
'web-runtime-cjs' : {
30
- entry : resolve ( 'src/entries/ web- runtime.js' ) ,
38
+ entry : resolve ( 'web/ runtime.js' ) ,
31
39
dest : resolve ( 'dist/vue.runtime.common.js' ) ,
32
40
format : 'cjs' ,
33
41
banner
34
42
} ,
35
43
// Runtime+compiler CommonJS build (CommonJS)
36
44
'web-full-cjs' : {
37
- entry : resolve ( 'src/entries/ web- runtime-with-compiler.js' ) ,
45
+ entry : resolve ( 'web/ runtime-with-compiler.js' ) ,
38
46
dest : resolve ( 'dist/vue.common.js' ) ,
39
47
format : 'cjs' ,
40
48
alias : { he : './entity-decoder' } ,
@@ -43,38 +51,38 @@ const builds = {
43
51
// Runtime only (ES Modules). Used by bundlers that support ES Modules,
44
52
// e.g. Rollup & Webpack 2
45
53
'web-runtime-esm' : {
46
- entry : resolve ( 'src/entries/ web- runtime.js' ) ,
54
+ entry : resolve ( 'web/ runtime.js' ) ,
47
55
dest : resolve ( 'dist/vue.runtime.esm.js' ) ,
48
56
format : 'es' ,
49
57
banner
50
58
} ,
51
59
// Runtime+compiler CommonJS build (ES Modules)
52
60
'web-full-esm' : {
53
- entry : resolve ( 'src/entries/ web- runtime-with-compiler.js' ) ,
61
+ entry : resolve ( 'web/ runtime-with-compiler.js' ) ,
54
62
dest : resolve ( 'dist/vue.esm.js' ) ,
55
63
format : 'es' ,
56
64
alias : { he : './entity-decoder' } ,
57
65
banner
58
66
} ,
59
67
// runtime-only build (Browser)
60
68
'web-runtime-dev' : {
61
- entry : resolve ( 'src/entries/ web- runtime.js' ) ,
69
+ entry : resolve ( 'web/ runtime.js' ) ,
62
70
dest : resolve ( 'dist/vue.runtime.js' ) ,
63
71
format : 'umd' ,
64
72
env : 'development' ,
65
73
banner
66
74
} ,
67
75
// runtime-only production build (Browser)
68
76
'web-runtime-prod' : {
69
- entry : resolve ( 'src/entries/ web- runtime.js' ) ,
77
+ entry : resolve ( 'web/ runtime.js' ) ,
70
78
dest : resolve ( 'dist/vue.runtime.min.js' ) ,
71
79
format : 'umd' ,
72
80
env : 'production' ,
73
81
banner
74
82
} ,
75
83
// Runtime+compiler development build (Browser)
76
84
'web-full-dev' : {
77
- entry : resolve ( 'src/entries/ web- runtime-with-compiler.js' ) ,
85
+ entry : resolve ( 'web/ runtime-with-compiler.js' ) ,
78
86
dest : resolve ( 'dist/vue.js' ) ,
79
87
format : 'umd' ,
80
88
env : 'development' ,
@@ -83,7 +91,7 @@ const builds = {
83
91
} ,
84
92
// Runtime+compiler production build (Browser)
85
93
'web-full-prod' : {
86
- entry : resolve ( 'src/entries/ web- runtime-with-compiler.js' ) ,
94
+ entry : resolve ( 'web/ runtime-with-compiler.js' ) ,
87
95
dest : resolve ( 'dist/vue.min.js' ) ,
88
96
format : 'umd' ,
89
97
env : 'production' ,
@@ -92,49 +100,49 @@ const builds = {
92
100
} ,
93
101
// Web compiler (CommonJS).
94
102
'web-compiler' : {
95
- entry : resolve ( 'src/entries/ web- compiler.js' ) ,
103
+ entry : resolve ( 'web/ compiler.js' ) ,
96
104
dest : resolve ( 'packages/vue-template-compiler/build.js' ) ,
97
105
format : 'cjs' ,
98
106
external : Object . keys ( require ( '../packages/vue-template-compiler/package.json' ) . dependencies )
99
107
} ,
100
108
// Web server renderer (CommonJS).
101
109
'web-server-renderer' : {
102
- entry : resolve ( 'src/entries/web- server-renderer .js' ) ,
110
+ entry : resolve ( 'server/index .js' ) ,
103
111
dest : resolve ( 'packages/vue-server-renderer/build.js' ) ,
104
112
format : 'cjs' ,
105
113
external : Object . keys ( require ( '../packages/vue-server-renderer/package.json' ) . dependencies )
106
114
} ,
107
115
'web-server-renderer-webpack-server-plugin' : {
108
- entry : resolve ( 'src/ server/webpack-plugin/server.js' ) ,
116
+ entry : resolve ( 'server/webpack-plugin/server.js' ) ,
109
117
dest : resolve ( 'packages/vue-server-renderer/server-plugin.js' ) ,
110
118
format : 'cjs' ,
111
119
external : Object . keys ( require ( '../packages/vue-server-renderer/package.json' ) . dependencies )
112
120
} ,
113
121
'web-server-renderer-webpack-client-plugin' : {
114
- entry : resolve ( 'src/ server/webpack-plugin/client.js' ) ,
122
+ entry : resolve ( 'server/webpack-plugin/client.js' ) ,
115
123
dest : resolve ( 'packages/vue-server-renderer/client-plugin.js' ) ,
116
124
format : 'cjs' ,
117
125
external : Object . keys ( require ( '../packages/vue-server-renderer/package.json' ) . dependencies )
118
126
} ,
119
127
// Weex runtime factory
120
128
'weex-factory' : {
121
129
weex : true ,
122
- entry : resolve ( 'src/entries/ weex-factory.js' ) ,
130
+ entry : resolve ( 'weex/runtime -factory.js' ) ,
123
131
dest : resolve ( 'packages/weex-vue-framework/factory.js' ) ,
124
132
format : 'cjs' ,
125
133
plugins : [ weexFactoryPlugin ]
126
134
} ,
127
135
// Weex runtime framework (CommonJS).
128
136
'weex-framework' : {
129
137
weex : true ,
130
- entry : resolve ( 'src/entries/ weex- framework.js' ) ,
138
+ entry : resolve ( 'weex/ framework.js' ) ,
131
139
dest : resolve ( 'packages/weex-vue-framework/index.js' ) ,
132
140
format : 'cjs'
133
141
} ,
134
142
// Weex compiler (CommonJS). Used by Weex's Webpack loader.
135
143
'weex-compiler' : {
136
144
weex : true ,
137
- entry : resolve ( 'src/entries/ weex- compiler.js' ) ,
145
+ entry : resolve ( 'weex/ compiler.js' ) ,
138
146
dest : resolve ( 'packages/weex-template-compiler/build.js' ) ,
139
147
format : 'cjs' ,
140
148
external : Object . keys ( require ( '../packages/weex-template-compiler/package.json' ) . dependencies )
@@ -157,7 +165,7 @@ function genConfig (opts) {
157
165
} ) ,
158
166
flow ( ) ,
159
167
buble ( ) ,
160
- alias ( Object . assign ( { } , require ( './alias' ) , opts . alias ) )
168
+ alias ( Object . assign ( { } , aliases , opts . alias ) )
161
169
] . concat ( opts . plugins || [ ] )
162
170
}
163
171
0 commit comments