mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-22 17:47:53 +00:00
Make source maps compatible with VS/VSCode debugging (fix file paths, and strip out the "charset=utf-8;" segments from inline sourceMappingURLs)
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||
var nodeExternals = require('webpack-node-externals');
|
||||
var merge = require('webpack-merge');
|
||||
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
|
||||
@@ -26,13 +27,15 @@ var sharedConfig = {
|
||||
var clientBundleConfig = merge(sharedConfig, {
|
||||
entry: { 'main-client': './ClientApp/boot-client.ts' },
|
||||
output: { path: path.join(__dirname, './wwwroot/dist') },
|
||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
||||
plugins: [
|
||||
new webpack.DllReferencePlugin({
|
||||
context: __dirname,
|
||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||
})
|
||||
].concat(isDevBuild ? [] : [
|
||||
].concat(isDevBuild ? [
|
||||
// Plugins that apply in development builds only
|
||||
new SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
|
||||
] : [
|
||||
// Plugins that apply in production builds only
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin()
|
||||
|
||||
@@ -2,9 +2,9 @@ var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
var SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||
|
||||
module.exports = {
|
||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
||||
entry: { 'main': './ClientApp/boot.ts' },
|
||||
resolve: { extensions: [ '', '.js', '.ts' ] },
|
||||
output: {
|
||||
@@ -25,7 +25,10 @@ module.exports = {
|
||||
context: __dirname,
|
||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||
})
|
||||
].concat(isDevBuild ? [] : [
|
||||
].concat(isDevBuild ? [
|
||||
// Plugins that apply in development builds only
|
||||
new SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
|
||||
] : [
|
||||
// Plugins that apply in production builds only
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
||||
|
||||
@@ -2,6 +2,7 @@ var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
var SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||
var nodeExternals = require('webpack-node-externals');
|
||||
var merge = require('webpack-merge');
|
||||
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
|
||||
@@ -31,14 +32,16 @@ var clientBundleConfig = merge(sharedConfig(), {
|
||||
]
|
||||
},
|
||||
output: { path: path.join(__dirname, './wwwroot/dist') },
|
||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
||||
plugins: [
|
||||
new ExtractTextPlugin('site.css'),
|
||||
new webpack.DllReferencePlugin({
|
||||
context: __dirname,
|
||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||
})
|
||||
].concat(isDevBuild ? [] : [
|
||||
].concat(isDevBuild ? [
|
||||
// Plugins that apply in development builds only
|
||||
new SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
|
||||
] : [
|
||||
// Plugins that apply in production builds only
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })
|
||||
|
||||
@@ -2,6 +2,7 @@ var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
||||
var path = require('path');
|
||||
var webpack = require('webpack');
|
||||
var ExtractTextPlugin = require('extract-text-webpack-plugin');
|
||||
var SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||
|
||||
module.exports = {
|
||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
||||
@@ -25,7 +26,10 @@ module.exports = {
|
||||
context: __dirname,
|
||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
||||
})
|
||||
].concat(isDevBuild ? [] : [
|
||||
].concat(isDevBuild ? [
|
||||
// Plugins that apply in development builds only
|
||||
new SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
|
||||
] : [
|
||||
// Plugins that apply in production builds only
|
||||
new webpack.optimize.OccurenceOrderPlugin(),
|
||||
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
||||
|
||||
@@ -1,3 +1,7 @@
|
||||
var SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||
|
||||
module.exports = {
|
||||
devtool: 'inline-source-map'
|
||||
plugins: [
|
||||
new SourceMapDevToolPlugin({ moduleFilenameTemplate: '../../[resourcePath]' }) // Compiled output is at './wwwroot/dist/', but sources are relative to './'
|
||||
]
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user