File tree 3 files changed +4356
-5
lines changed
Filter options
3 files changed +4356
-5
lines changed
Original file line number Diff line number Diff line change 1
- var fs = require ( 'fs' )
2
- var path = require ( 'path' )
3
1
var cwd = process . cwd ( )
2
+ var resolve = require ( 'resolve' )
4
3
5
4
// attempts to first require a dep using projects cwd (when vue-loader is linked)
6
5
// then try a normal require.
7
6
module . exports = function tryRequire ( dep ) {
8
- var cwdPath = path . resolve ( cwd , 'node_modules' , dep )
9
- if ( fs . existsSync ( cwdPath ) ) {
10
- return require ( cwdPath )
7
+ var fromCwd
8
+ try {
9
+ fromCwd = resolve . sync ( dep , { basedir : cwd } )
10
+ } catch ( e ) { }
11
+ if ( fromCwd ) {
12
+ return require ( fromCwd )
11
13
} else {
12
14
try {
13
15
return require ( dep )
Original file line number Diff line number Diff line change 37
37
"postcss" : " ^5.0.21" ,
38
38
"postcss-load-config" : " ^1.1.0" ,
39
39
"postcss-selector-parser" : " ^2.0.0" ,
40
+ "resolve" : " ^1.3.3" ,
40
41
"source-map" : " ^0.5.6" ,
41
42
"vue-hot-reload-api" : " ^2.1.0" ,
42
43
"vue-style-loader" : " ^3.0.0" ,
You can’t perform that action at this time.
0 commit comments