WebpackAspnetMiddleware icon indicating copy to clipboard operation
WebpackAspnetMiddleware copied to clipboard

Debugging possible with Visual Studio?

Open ghost opened this issue 7 years ago • 4 comments

Hello,

First, great project, it's a life saver ! :)

I was wondering if we could still benefit of debugging TypeScript code within Visual Studio, apparently it's no longer the case with your sample and the app I quickly cook.

I'm not webpack expert, but the .js.map are generated fine, but apparently VS can't relate .ts files with what's being executed.

Thanks

ghost avatar Jun 15 '18 17:06 ghost

Thanks!

I suspect this is because the bundles are not being written to the file system, they are just held in memory. You could try adding the WriteFilePlugin? Let me know if that works, and I can add it to the readme, otherwise I can change the handler to write the files out to disk as well.

frankwallis avatar Jun 16 '18 15:06 frankwallis

Well, I don't know if I used it well, but it doesn't work better. Here's my webpack config:

var path = require('path');
var webpack = require('webpack');
var WebpackNotifierPlugin = require('webpack-notifier');
var WriteFileWebpackPlugin = require('write-file-webpack-plugin');

module.exports = function (env) {
    return {
        mode: env,
        context: path.join(__dirname, 'Scripts'),
        entry: ['react-hot-loader/patch', 'webpack-aspnet-middleware/client', './index'],
        devtool: 'source-map',
        resolve: {
            extensions: ['.ts', '.tsx', '.js', '.jsx']
        },
        externals: {
            "oimo": "OIMO",
            "cannon": "CANNON",
            "earcut": true
        },
        output: {
            publicPath: '/webpack/',
            path: path.join(__dirname, 'wwwroot', 'webpack'),
            filename: '[name].bundle.js'
        },
        plugins: [
            new WebpackNotifierPlugin(),
            new webpack.HotModuleReplacementPlugin(),
            new WriteFileWebpackPlugin({ test: /\.tsx?$/})
        ],
        module: {
            rules: [
                { test: /\.tsx?$/, use: ['react-hot-loader/webpack', 'awesome-typescript-loader'], exclude: /node_modules/ },
                { test: /\.css$/, use: ['style-loader', 'css-loader'] }
            ]
        }
    };
}

Strange this I discovered: if I put a breakpoint in Chrome and make it hit, then will it also hit in Visual Studio and then I'll be able to put other breakpoints in VS and debug there as well...

Thank you for the help! The web is a jungle and I don't go there very often on the client side! :)

ghost avatar Jun 16 '18 16:06 ghost

What if you try it without any arguments new WriteFileWebpackPlugin()? The files being written are the final bundles so they will be .js etc.

frankwallis avatar Jun 16 '18 17:06 frankwallis

Still no effect.

ghost avatar Jun 16 '18 17:06 ghost