Switch from inline to external source maps. This avoids several problems with inline source maps in VS 2015 (at least as of Update 3).

This commit is contained in:
SteveSandersonMS
2016-10-21 10:10:20 +01:00
parent 8c766c0382
commit 0615578d9a
10 changed files with 44 additions and 9 deletions

View File

@@ -60,6 +60,9 @@
"Views", "Views",
"web.config", "web.config",
"wwwroot" "wwwroot"
],
"exclude": [
"wwwroot/dist/*.map"
] ]
}, },

View File

@@ -23,9 +23,10 @@ var sharedConfig = {
}; };
// Configuration for client-side bundle suitable for running in browsers // Configuration for client-side bundle suitable for running in browsers
var clientBundleOutputDir = './wwwroot/dist';
var clientBundleConfig = merge(sharedConfig, { var clientBundleConfig = merge(sharedConfig, {
entry: { 'main-client': './ClientApp/boot-client.ts' }, entry: { 'main-client': './ClientApp/boot-client.ts' },
output: { path: path.join(__dirname, './wwwroot/dist') }, output: { path: path.join(__dirname, clientBundleOutputDir) },
plugins: [ plugins: [
new webpack.DllReferencePlugin({ new webpack.DllReferencePlugin({
context: __dirname, context: __dirname,
@@ -33,7 +34,10 @@ var clientBundleConfig = merge(sharedConfig, {
}) })
].concat(isDevBuild ? [ ].concat(isDevBuild ? [
// Plugins that apply in development builds only // Plugins that apply in development builds only
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './' new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map', // Remove this line if you prefer inline source maps
moduleFilenameTemplate: path.relative(clientBundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
})
] : [ ] : [
// Plugins that apply in production builds only // Plugins that apply in production builds only
new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.OccurenceOrderPlugin(),

View File

@@ -59,6 +59,9 @@
"Views", "Views",
"web.config", "web.config",
"wwwroot" "wwwroot"
],
"exclude": [
"wwwroot/dist/*.map"
] ]
}, },

View File

@@ -3,11 +3,12 @@ var path = require('path');
var webpack = require('webpack'); var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin');
var bundleOutputDir = './wwwroot/dist';
module.exports = { module.exports = {
entry: { 'main': './ClientApp/boot.ts' }, entry: { 'main': './ClientApp/boot.ts' },
resolve: { extensions: [ '', '.js', '.ts' ] }, resolve: { extensions: [ '', '.js', '.ts' ] },
output: { output: {
path: path.join(__dirname, './wwwroot/dist'), path: path.join(__dirname, bundleOutputDir),
filename: '[name].js', filename: '[name].js',
publicPath: '/dist/' publicPath: '/dist/'
}, },
@@ -26,7 +27,10 @@ module.exports = {
}) })
].concat(isDevBuild ? [ ].concat(isDevBuild ? [
// Plugins that apply in development builds only // Plugins that apply in development builds only
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './' new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map', // Remove this line if you prefer inline source maps
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
})
] : [ ] : [
// Plugins that apply in production builds only // Plugins that apply in production builds only
new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.OccurenceOrderPlugin(),

View File

@@ -60,6 +60,9 @@
"Views", "Views",
"web.config", "web.config",
"wwwroot" "wwwroot"
],
"exclude": [
"wwwroot/dist/*.map"
] ]
}, },

View File

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

View File

@@ -59,6 +59,9 @@
"Views", "Views",
"web.config", "web.config",
"wwwroot" "wwwroot"
],
"exclude": [
"wwwroot/dist/*.map"
] ]
}, },

View File

@@ -3,12 +3,13 @@ var path = require('path');
var webpack = require('webpack'); var webpack = require('webpack');
var ExtractTextPlugin = require('extract-text-webpack-plugin'); var ExtractTextPlugin = require('extract-text-webpack-plugin');
var bundleOutputDir = './wwwroot/dist';
module.exports = { module.exports = {
devtool: isDevBuild ? 'inline-source-map' : null, devtool: isDevBuild ? 'inline-source-map' : null,
entry: { 'main': './ClientApp/boot.tsx' }, entry: { 'main': './ClientApp/boot.tsx' },
resolve: { extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ] }, resolve: { extensions: [ '', '.js', '.jsx', '.ts', '.tsx' ] },
output: { output: {
path: path.join(__dirname, './wwwroot/dist'), path: path.join(__dirname, bundleOutputDir),
filename: '[name].js', filename: '[name].js',
publicPath: '/dist/' publicPath: '/dist/'
}, },
@@ -27,7 +28,10 @@ module.exports = {
}) })
].concat(isDevBuild ? [ ].concat(isDevBuild ? [
// Plugins that apply in development builds only // Plugins that apply in development builds only
new webpack.SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './' new webpack.SourceMapDevToolPlugin({
filename: '[name].js.map', // Remove this line if you prefer inline source maps
moduleFilenameTemplate: path.relative(bundleOutputDir, '[resourcePath]') // Point sourcemap entries to the original file locations on disk
})
] : [ ] : [
// Plugins that apply in production builds only // Plugins that apply in production builds only
new webpack.optimize.OccurenceOrderPlugin(), new webpack.optimize.OccurenceOrderPlugin(),

View File

@@ -56,6 +56,9 @@
"Views", "Views",
"web.config", "web.config",
"wwwroot" "wwwroot"
],
"exclude": [
"wwwroot/dist/*.map"
] ]
}, },

View File

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