mirror of
https://github.com/aspnet/JavaScriptServices.git
synced 2025-12-23 01:58:29 +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 isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
||||||
var path = require('path');
|
var path = require('path');
|
||||||
var webpack = require('webpack');
|
var webpack = require('webpack');
|
||||||
|
var SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||||
var nodeExternals = require('webpack-node-externals');
|
var nodeExternals = require('webpack-node-externals');
|
||||||
var merge = require('webpack-merge');
|
var merge = require('webpack-merge');
|
||||||
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
|
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
|
||||||
@@ -26,13 +27,15 @@ var sharedConfig = {
|
|||||||
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, './wwwroot/dist') },
|
||||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new webpack.DllReferencePlugin({
|
new webpack.DllReferencePlugin({
|
||||||
context: __dirname,
|
context: __dirname,
|
||||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
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
|
// Plugins that apply in production builds only
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
new webpack.optimize.UglifyJsPlugin()
|
new webpack.optimize.UglifyJsPlugin()
|
||||||
|
|||||||
@@ -2,9 +2,9 @@ var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
|||||||
var path = require('path');
|
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 SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
|
||||||
entry: { 'main': './ClientApp/boot.ts' },
|
entry: { 'main': './ClientApp/boot.ts' },
|
||||||
resolve: { extensions: [ '', '.js', '.ts' ] },
|
resolve: { extensions: [ '', '.js', '.ts' ] },
|
||||||
output: {
|
output: {
|
||||||
@@ -25,7 +25,10 @@ module.exports = {
|
|||||||
context: __dirname,
|
context: __dirname,
|
||||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
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
|
// Plugins that apply in production builds only
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
|||||||
var path = require('path');
|
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 SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||||
var nodeExternals = require('webpack-node-externals');
|
var nodeExternals = require('webpack-node-externals');
|
||||||
var merge = require('webpack-merge');
|
var merge = require('webpack-merge');
|
||||||
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
|
var allFilenamesExceptJavaScript = /\.(?!js(\?|$))([^.]+(\?|$))/;
|
||||||
@@ -31,14 +32,16 @@ var clientBundleConfig = merge(sharedConfig(), {
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
output: { path: path.join(__dirname, './wwwroot/dist') },
|
output: { path: path.join(__dirname, './wwwroot/dist') },
|
||||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
|
||||||
plugins: [
|
plugins: [
|
||||||
new ExtractTextPlugin('site.css'),
|
new ExtractTextPlugin('site.css'),
|
||||||
new webpack.DllReferencePlugin({
|
new webpack.DllReferencePlugin({
|
||||||
context: __dirname,
|
context: __dirname,
|
||||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
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
|
// Plugins that apply in production builds only
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })
|
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } })
|
||||||
|
|||||||
@@ -2,6 +2,7 @@ var isDevBuild = process.argv.indexOf('--env.prod') < 0;
|
|||||||
var path = require('path');
|
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 SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||||
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
devtool: isDevBuild ? 'inline-source-map' : null,
|
devtool: isDevBuild ? 'inline-source-map' : null,
|
||||||
@@ -25,7 +26,10 @@ module.exports = {
|
|||||||
context: __dirname,
|
context: __dirname,
|
||||||
manifest: require('./wwwroot/dist/vendor-manifest.json')
|
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
|
// Plugins that apply in production builds only
|
||||||
new webpack.optimize.OccurenceOrderPlugin(),
|
new webpack.optimize.OccurenceOrderPlugin(),
|
||||||
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
new webpack.optimize.UglifyJsPlugin({ compress: { warnings: false } }),
|
||||||
|
|||||||
@@ -1,3 +1,7 @@
|
|||||||
|
var SourceMapDevToolPlugin = require('aspnet-webpack').SourceMapDevToolPlugin;
|
||||||
|
|
||||||
module.exports = {
|
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