22
33var path = require ( 'path' ) ;
44
5- var webpack = require ( 'webpack' ) ,
6- ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ,
7- BowerWebpackPlugin = require ( 'bower-webpack-plugin' ) ,
8- EntryGeneratorPlugin = require ( 'entry-generator-webpack-plugin' ) ,
9- OmitTildePlugin = require ( 'omit-tilde-webpack-plugin' ) ;
5+ var webpack = require ( 'webpack' ) ,
6+ adjustSourcemapLoader = require ( 'adjust-sourcemap-loader' ) ,
7+ ExtractTextPlugin = require ( 'extract-text-webpack-plugin' ) ,
8+ BowerWebpackPlugin = require ( 'bower-webpack-plugin' ) ,
9+ EntryGeneratorPlugin = require ( 'entry-generator-webpack-plugin' ) ,
10+ OmitTildePlugin = require ( 'omit-tilde-webpack-plugin' ) ;
1011
1112/**
1213 * Add configuration common to all modes.
@@ -16,7 +17,10 @@ var webpack = require('webpack'),
1617 * @returns {Config } The given webpack-configurator instance
1718 */
1819function common ( loaderRoot , options ) {
19- var vendorEntry = path . resolve ( options . appDir , 'vendor.js' ) ;
20+ var vendorEntry = path . resolve ( options . appDir , 'vendor.js' ) ,
21+ templateFn = adjustSourcemapLoader . moduleFilenameTemplate ( {
22+ format : 'projectRelative'
23+ } ) ;
2024
2125 // Note that DedupePlugin causes problems when npm linked so we will ommit it from the common configuration
2226 // you need to add it yourself if you wish to use it
@@ -34,8 +38,8 @@ function common(loaderRoot, options) {
3438 output : {
3539 filename : '[name].[chunkhash].js' ,
3640 chunkFilename : '[name].[chunkhash].js' ,
37- devtoolModuleFilenameTemplate : '[resource-path]' ,
38- devtoolFallbackModuleFilenameTemplate : '[resource-path]?[hash]'
41+ devtoolModuleFilenameTemplate : templateFn ,
42+ devtoolFallbackModuleFilenameTemplate : templateFn
3943 } ,
4044 resolve : {
4145 // do not use root as we want node_modules in linked projects to take precedence
@@ -103,7 +107,6 @@ function common(loaderRoot, options) {
103107 test : / \. j s $ / i,
104108 exclude : / [ \\ \/ ] ( b o w e r _ c o m p o n e n t s | w e b p a c k | c s s - l o a d e r ) [ \\ \/ ] / i,
105109 loaders : [
106- 'adjust-sourcemap?format=projectRelative' ,
107110 'ng-annotate?sourceMap' ,
108111 'adjust-sourcemap?format=absolute' , // fix ng-annotate source maps in Windows but tweaking incoming map
109112 'nginject?sourceMap&deprecate&singleQuote' ,
0 commit comments