Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debugging possible with Visual Studio? #16

Open
ghost opened this issue Jun 15, 2018 · 4 comments
Open

Debugging possible with Visual Studio? #16

ghost opened this issue Jun 15, 2018 · 4 comments

Comments

@ghost
Copy link

ghost commented Jun 15, 2018

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

@frankwallis
Copy link
Owner

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.

@ghost
Copy link
Author

ghost commented Jun 16, 2018

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! :)

@frankwallis
Copy link
Owner

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

@ghost
Copy link
Author

ghost commented Jun 16, 2018

Still no effect.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant