Skip to content

Sourcemaps not working with babel + ng-annotate #23

@killersite

Description

@killersite
module.exports = {
    devtool: 'sourcemap',
    context: __dirname + '/app',
    entry: './index.js',
    output: {
        filename: 'bundle.js'
    },
    module: {
        loaders: [
            // run babel first then ng-annotate
            { test: /\.js$/, loaders: ['ng-annotate','babel'] }
        ]
    }
};

When I use the above webpack config the source-map file is messed up with duplicate entries like the following.

"webpack:///./index.js",
"webpack:///./index.js?2645",
"webpack:///../~/angular/index.js",
"webpack:///../~/angular/index.js?08f2",
"webpack:///../~/angular/angular.js",
"webpack:///../~/angular/angular.js?58d0",

This is causing Chrome to not find the correct lines...

It seems that ng-annotate is inserting lines in the code without the source-map getting corrected info.

So where before ng-annotate (when the source-map was created) the code looked like

        /* @ngInject */
        function HeroController(users) {

now after ng-annotate there are new lines that the source-map doesnt know about

        /* @ngInject */
        HeroController.$inject = ["users"];
        function HeroController(users) {

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions