Giter VIP home page Giter VIP logo

vs-fix-sourcemaps's Introduction

Fix Webpack JSX and JS Sourcemaps in Visual Studio

This plugin allows you to debug Webpack-bundled JS and JSX (yes, you heard that right, JSX) files directly in Visual Studio 2015 (from the original source);

Problem

Visual Studio (2015) doesn't support 'traditional' forms of JS debugging by setting breakpoints directly in Visual Studio. You can read the issues here:

A Solution

While the problem seems to be with Visual Studio, this webpack plugin seems to solve the issue (at least so far - if you find a bug please submit a PR).

This plugin only has one job: fix sourcemaps. No options or configuration - at least not yet.

If you are installing this plugin, you are most likely using IE. Make sure you are adding the Event Source pollyfill in IE if you are using hot middleware: webpack-contrib/webpack-hot-middleware#11

Usage

npm install --save-dev vs-fix-sourcemaps

In your Webpack config file, under plugins, add this plugin:

import VSFixSourceMapsPlugin from 'vs-fix-sourcemaps';
...
  devtool: 'source-map',
  plugins: [
    new VSFixSourceMapsPlugin(),
    new webpack.optimize.OccurenceOrderPlugin(), 
    new webpack.HotModuleReplacementPlugin(), // hot loading!
    new webpack.NoErrorsPlugin()
  ]
...

Known Issues

If you are using hot middleware of any kind (like React Hot Loader or React Transforms), hot loading will not always hit breakpoints in Visual Studio. It is buggy. The problem stems from the way the referenced paths are stored in memory by Visual Studio and Webpack. If it isn't working, refreshing the page should fix it. Lame, I know, but I have not found a fix for this yet. If you have a way to make it work, I am happy to accept your PR!

Contributing

Yes please. Submit your PR.

vs-fix-sourcemaps's People

Contributors

joevbruno avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.