andrey-skl / ng-annotate-loader

Webpack loader to annotate angular applications
MIT License
120 stars 28 forks source link

Fix sourcemaps when chaining loaders #5

Closed mattlewis92 closed 9 years ago

mattlewis92 commented 9 years ago

The sourcemaps are passed the wrong way round which breaks them when using previous loaders. For example:

Sample es6

import angular from 'angular';
var app = angular.module('myApp', []);

function testFactory($location) {
    'ngInject'; 
}

app.factory('test', testFactory);

app.run(function($http) {
    throw new Error('test');
});

Sample webpack config

module.exports = {
    entry: "./index",
        output: {
            path: __dirname + "/dist",
            filename: "bundle.js"
        },
    module: {
      loaders: [
        {
          test: /\.js?$/,
          exclude: /(node_modules|bower_components)/,
          loaders: ['ng-annotate', 'babel?optional[]=es7.decorators&optional[]=runtime']
        }
      ]
    },
    devtool: 'source-map'
};

If you run that in your browser you get this: screen shot 2015-07-02 at 00 18 08

andrey-skl commented 9 years ago

Causes #6