@@ -19,6 +19,10 @@ function common(loaderRoot, options) {
1919 /* jshint validthis:true */
2020 var vendorEntry = path . resolve ( options . appDir , 'vendor.js' ) ;
2121
22+ // Note that DedupePlugin causes problems when npm linked so we will ommit it from the common configuration
23+ // you need to add it yourself if you wish to use it
24+ // https://github.com/webpack/karma-webpack/issues/41#issuecomment-139516692
25+
2226 return this
2327 . merge ( {
2428 context : process . cwd ( ) ,
@@ -34,15 +38,14 @@ function common(loaderRoot, options) {
3438 devtoolFallbackModuleFilenameTemplate : '[resource-path]?[hash]'
3539 } ,
3640 resolve : {
37- alias : {
38- npm : path . resolve ( 'node_modules' )
39- } ,
40- root : path . resolve ( 'node_modules' ) ,
41- fallback : path . resolve ( 'bower_components' )
41+ // do not use root as we want node_modules in linked projects to take precedence
42+ modulesDirectories : [ 'node_modules' , 'bower_components' ] ,
43+ fallback : [ path . resolve ( 'node_modules' ) , path . resolve ( 'bower_components' ) ]
4244 } ,
4345 resolveLoader : {
44- root : loaderRoot ,
45- fallback : path . resolve ( 'node_modules' )
46+ // do not use root as we want node_modules in linked projects to take precedence
47+ modulesDirectories : [ 'node_modules' ] ,
48+ fallback : [ loaderRoot , path . resolve ( 'node_modules' ) ]
4649 } ,
4750 node : {
4851 fs : 'empty'
@@ -145,7 +148,6 @@ function common(loaderRoot, options) {
145148 name : 'vendor' ,
146149 minChunks : Infinity
147150 } ] )
148- . plugin ( 'dedupe' , webpack . optimize . DedupePlugin )
149151 . plugin ( 'occurence-order' , webpack . optimize . OccurenceOrderPlugin ) ;
150152}
151153
0 commit comments