@@ -51,7 +51,7 @@ var localConfig
51
51
// config option in only available in CLI option
52
52
if ( ! program . disableConfig ) {
53
53
var localConfigPath = typeof program . config === 'string'
54
- ? path . join ( process . cwd ( ) , program . config )
54
+ ? cwd ( program . config )
55
55
: path . join ( home , '.vue' , 'config.js' )
56
56
var hasLocalConfig = fs . existsSync ( localConfigPath )
57
57
if ( hasLocalConfig ) {
@@ -133,7 +133,7 @@ var webpackConfig = {
133
133
client : [ ]
134
134
} ,
135
135
output : {
136
- path : path . join ( process . cwd ( ) , options . dist ) ,
136
+ path : cwd ( options . dist ) ,
137
137
filename : filenames . js ,
138
138
publicPath : '/'
139
139
} ,
@@ -143,16 +143,16 @@ var webpackConfig = {
143
143
resolve : {
144
144
extensions : [ '.js' , '.vue' , '.css' ] ,
145
145
modules : [
146
- process . cwd ( ) ,
147
- path . join ( process . cwd ( ) , 'node_modules' ) , // modules in cwd's node_modules
148
- path . join ( __dirname , '../ node_modules') // modules in package's node_modules
146
+ cwd ( ) ,
147
+ cwd ( 'node_modules' ) , // modules in cwd's node_modules
148
+ ownDir ( ' node_modules') // modules in package's node_modules
149
149
] ,
150
150
alias : { }
151
151
} ,
152
152
resolveLoader : {
153
153
modules : [
154
- path . join ( process . cwd ( ) , 'node_modules' ) , // loaders in cwd's node_modules
155
- path . join ( __dirname , '../ node_modules') // loaders in package's node_modules
154
+ cwd ( 'node_modules' ) , // loaders in cwd's node_modules
155
+ ownDir ( ' node_modules') // loaders in package's node_modules
156
156
]
157
157
} ,
158
158
module : {
@@ -215,8 +215,8 @@ if (options.mount === undefined && !options.lib && /\.vue$/.test(options.entry))
215
215
// set an alias to the path of the component
216
216
// otherwise use it directly as webpack entry
217
217
if ( options . mount ) {
218
- webpackConfig . entry . client . push ( path . join ( __dirname , '../ lib/default-entry.es6') )
219
- webpackConfig . resolve . alias [ 'your-tasteful-component' ] = path . resolve ( process . cwd ( ) , options . entry )
218
+ webpackConfig . entry . client . push ( ownDir ( ' lib/default-entry.es6') )
219
+ webpackConfig . resolve . alias [ 'your-tasteful-component' ] = cwd ( options . entry )
220
220
} else {
221
221
webpackConfig . entry . client . push ( options . entry )
222
222
}
@@ -234,7 +234,7 @@ if (options.lib) {
234
234
webpackConfig . plugins . unshift (
235
235
new HtmlWebpackPlugin ( Object . assign ( {
236
236
title : 'Vue App' ,
237
- template : path . join ( __dirname , '../ lib/template.html')
237
+ template : ownDir ( ' lib/template.html')
238
238
} , options . html ) )
239
239
)
240
240
}
@@ -243,9 +243,9 @@ if (options.lib) {
243
243
if ( isYarn ( __dirname ) ) {
244
244
// modules in yarn global node_modules
245
245
// because of yarn's flat node_modules structure
246
- webpackConfig . resolve . modules . push ( path . join ( __dirname , '../../ ' ) )
246
+ webpackConfig . resolve . modules . push ( ownDir ( '..' ) )
247
247
// loaders in yarn global node_modules
248
- webpackConfig . resolveLoader . modules . push ( path . join ( __dirname , '../../ ' ) )
248
+ webpackConfig . resolveLoader . modules . push ( ownDir ( '..' ) )
249
249
}
250
250
251
251
if ( production ) {
@@ -291,7 +291,7 @@ if (!options.disableWebpackConfig) {
291
291
webpackConfig = options . webpack ( webpackConfig , options , webpack )
292
292
} else {
293
293
var localWebpackConfigPath = typeof options . webpack === 'string'
294
- ? path . join ( process . cwd ( ) , options . webpack )
294
+ ? cwd ( options . webpack )
295
295
: path . join ( home , '.vue' , 'webpack.config.js' )
296
296
var hasLocalWebpackConfig = fs . existsSync ( localWebpackConfigPath )
297
297
if ( hasLocalWebpackConfig ) {
@@ -396,3 +396,11 @@ function getFilenames (options) {
396
396
static : options . lib ? 'static/[name].[ext]' : 'static/[name].[hash:8].[ext]'
397
397
} , options . filename )
398
398
}
399
+
400
+ function cwd ( file ) {
401
+ return path . resolve ( file || '' )
402
+ }
403
+
404
+ function ownDir ( file ) {
405
+ return path . join ( __dirname , '..' , file || '' )
406
+ }
0 commit comments