Skip to content

Commit 0615578

Browse files
Switch from inline to external source maps. This avoids several problems with inline source maps in VS 2015 (at least as of Update 3).
1 parent 8c766c0 commit 0615578

File tree

10 files changed

+44
-9
lines changed

10 files changed

+44
-9
lines changed

templates/Angular2Spa/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
"Views",
6161
"web.config",
6262
"wwwroot"
63+
],
64+
"exclude": [
65+
"wwwroot/dist/*.map"
6366
]
6467
},
6568

templates/Angular2Spa/webpack.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,21 @@ var sharedConfig = {
2323
};
2424

2525
// Configuration for client-side bundle suitable for running in browsers
26+
var clientBundleOutputDir = './wwwroot/dist';
2627
var clientBundleConfig = merge(sharedConfig, {
2728
entry: { 'main-client': './ClientApp/boot-client.ts' },
28-
output: { path: path.join(__dirname, './wwwroot/dist') },
29+
output: { path: path.join(__dirname, clientBundleOutputDir) },
2930
plugins: [
3031
new webpack.DllReferencePlugin({
3132
context: __dirname,
3233
manifest: require('./wwwroot/dist/vendor-manifest.json')
3334
})
3435
].concat(isDevBuild ? [
3536
// Plugins that apply in development builds only
36-
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
37+
new webpack.SourceMapDevToolPlugin({
38+
filename: '[name].js.map', // Remove this line if you prefer inline source maps
39+
moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
40+
})
3741
] : [
3842
// Plugins that apply in production builds only
3943
new webpack.optimize.OccurenceOrderPlugin(),

templates/KnockoutSpa/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
"Views",
6060
"web.config",
6161
"wwwroot"
62+
],
63+
"exclude": [
64+
"wwwroot/dist/*.map"
6265
]
6366
},
6467

templates/KnockoutSpa/webpack.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,12 @@ var path = require('path');
33
var webpack = require('webpack');
44
var ExtractTextPlugin = require('extract-text-webpack-plugin');
55

6+
var bundleOutputDir = './wwwroot/dist';
67
module.exports = {
78
entry: { 'main': './ClientApp/boot.ts' },
89
resolve: { extensions: [ '', '.js', '.ts' ] },
910
output: {
10-
path: path.join(__dirname, './wwwroot/dist'),
11+
path: path.join(__dirname, bundleOutputDir),
1112
filename: '[name].js',
1213
publicPath: '/dist/'
1314
},
@@ -26,7 +27,10 @@ module.exports = {
2627
})
2728
].concat(isDevBuild ? [
2829
// Plugins that apply in development builds only
29-
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
30+
new webpack.SourceMapDevToolPlugin({
31+
filename: '[name].js.map', // Remove this line if you prefer inline source maps
32+
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
33+
})
3034
] : [
3135
// Plugins that apply in production builds only
3236
new webpack.optimize.OccurenceOrderPlugin(),

templates/ReactReduxSpa/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,9 @@
6060
"Views",
6161
"web.config",
6262
"wwwroot"
63+
],
64+
"exclude": [
65+
"wwwroot/dist/*.map"
6366
]
6467
},
6568

templates/ReactReduxSpa/webpack.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var sharedConfig = () => ({
2222
});
2323

2424
// Configuration for client-side bundle suitable for running in browsers
25+
var clientBundleOutputDir = './wwwroot/dist';
2526
var clientBundleConfig = merge(sharedConfig(), {
2627
entry: { 'main-client': './ClientApp/boot-client.tsx' },
2728
module: {
@@ -30,7 +31,7 @@ var clientBundleConfig = merge(sharedConfig(), {
3031
{ test: /\.(png|jpg|jpeg|gif|svg)$/, loader: 'url', query: { limit: 25000 } }
3132
]
3233
},
33-
output: { path: path.join(__dirname, './wwwroot/dist') },
34+
output: { path: path.join(__dirname, clientBundleOutputDir) },
3435
plugins: [
3536
new ExtractTextPlugin('site.css'),
3637
new webpack.DllReferencePlugin({
@@ -39,7 +40,10 @@ var clientBundleConfig = merge(sharedConfig(), {
3940
})
4041
].concat(isDevBuild ? [
4142
// Plugins that apply in development builds only
42-
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
43+
new webpack.SourceMapDevToolPlugin({
44+
filename: '[name].js.map', // Remove this line if you prefer inline source maps
45+
moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
46+
})
4347
] : [
4448
// Plugins that apply in production builds only
4549
new webpack.optimize.OccurenceOrderPlugin(),

templates/ReactSpa/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,9 @@
5959
"Views",
6060
"web.config",
6161
"wwwroot"
62+
],
63+
"exclude": [
64+
"wwwroot/dist/*.map"
6265
]
6366
},
6467

templates/ReactSpa/webpack.config.js

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,13 @@ var path = require('path');
33
var webpack = require('webpack');
44
var ExtractTextPlugin = require('extract-text-webpack-plugin');
55

6+
var bundleOutputDir = './wwwroot/dist';
67
module.exports = {
78
devtool: isDevBuild ? 'inline-source-map' : null,
89
entry: { 'main': './ClientApp/boot.tsx' },
910
resolve: { extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ] },
1011
output: {
11-
path: path.join(__dirname, './wwwroot/dist'),
12+
path: path.join(__dirname, bundleOutputDir),
1213
filename: '[name].js',
1314
publicPath: '/dist/'
1415
},
@@ -27,7 +28,10 @@ module.exports = {
2728
})
2829
].concat(isDevBuild ? [
2930
// Plugins that apply in development builds only
30-
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
31+
new webpack.SourceMapDevToolPlugin({
32+
filename: '[name].js.map', // Remove this line if you prefer inline source maps
33+
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
34+
})
3135
] : [
3236
// Plugins that apply in production builds only
3337
new webpack.optimize.OccurenceOrderPlugin(),

templates/WebApplicationBasic/project.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@
5656
"Views",
5757
"web.config",
5858
"wwwroot"
59+
],
60+
"exclude": [
61+
"wwwroot/dist/*.map"
5962
]
6063
},
6164

templates/WebApplicationBasic/webpack.config.dev.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ var webpack = require('webpack');
22

33
module.exports = {
44
plugins: [
5-
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
5+
// Plugins that apply in development builds only
6+
new webpack.SourceMapDevToolPlugin({
7+
filename: '[name].js.map', // Remove this line if you prefer inline source maps
8+
moduleFilenameTemplate: path.relative('./wwwroot/dist', '[resourcePath]') // Point sourcemap entries to the original file locations on disk
9+
})
610
]
711
};

0 commit comments

Comments
 (0)