Skip to content

Commit fb57175

Browse files
author
benholloway
committed
use templateFn in attempt to correct source-map sources in the output
1 parent 893ca6f commit fb57175

File tree

2 files changed

+13
-10
lines changed

2 files changed

+13
-10
lines changed

config/add/common.js

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,12 @@
22

33
var 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
*/
1819
function 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 : /\.js$/i,
104108
exclude: /[\\\/](bower_components|webpack|css-loader)[\\\/]/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',

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
},
2020
"homepage": "https://github.com/angularity/webpack-angularity-solution",
2121
"dependencies": {
22-
"adjust-sourcemap-loader": "^0.0.1",
22+
"adjust-sourcemap-loader": "^0.1.0",
2323
"babel-core": "^6.4.5",
2424
"babel-loader": "^6.2.1",
2525
"bower-webpack-plugin": "^0.1.9",

0 commit comments

Comments
 (0)