Experience-Monks / devtool

[OBSOLETE] runs Node.js programs through Chromium DevTools
MIT License
3.77k stars 150 forks source link

Broken with babel-register source mapping #74

Open samdj opened 8 years ago

samdj commented 8 years ago

I'm trying to run something like so:

require('babel-register')
// Do stuff

It only works with --no-source-maps. I'm getting this error:

/home/dev/W/app/index.js
/home/dev/W/app/node_modules/babel-register/lib/node.js
/home/dev/W/app/node_modules/babel-core/index.js
/home/dev/W/app/node_modules/babel-core/lib/api/node.js
/home/dev/W/app/node_modules/babel-core/lib/transformation/file/index.js
/home/dev/W/app/node_modules/convert-source-map/index.js
An error occurred while trying to read the map file at node_modules/convert-source-map/foo.js.map
Error: ENOENT: no such file or directory, open 'node_modules/convert-source-map/foo.js.map'

Using this babelrc:

{
    "presets": ["es2015-node5"],
    "plugins": [
        "transform-object-rest-spread",
        "transform-class-properties",
        "add-module-exports",
        [
            "transform-async-to-module-method",
            { "module": "bluebird", "method": "coroutine" }
        ]
    ]
}

Using node v5.12

├─┬ babel-preset-es2015@6.9.0
│ └─┬ babel-plugin-transform-regenerator@6.9.0
│   └─┬ babel-core@6.10.4
│     └── babel-register@6.9.0 
└── babel-register@6.8.0 

Any ideas?

aleclarson commented 8 years ago

This is an issue with thlorenz/convert-source-map.

What's happening is that both devtool and babel-core depend on convert-source-map. This causes the source map converter to parse itself. This shouldn't be a problem, except there is a comment in convert-source-map/index.js that has a fake sourceMappingURL.

Just remove this line to fix it. :+1:

There are 3 ways to go about this:

samdj commented 8 years ago

Interesting @aleclarson, that is quite a hacky fix.

dtothefp commented 8 years ago

@aleclarson looks like I'm getting this error when just trying to run gulp without babel

devtool `which gulp`
screen shot 2016-09-04 at 3 48 54 pm
aleclarson commented 8 years ago

@dtothefp Looks like you have convert-source-map installed in your devtool-test package? And devtool/node_modules/convert-source-map/index.js is parsing the example.

pennyandsean commented 8 years ago

Seems to only be a problem when devtool is global

MiracleBlue commented 8 years ago

Aw damn it :( just found this tool and this caught me right off the bat. I need sourcemaps to be there, can't really do without them. Hopefully the source map folks get time to make a fix.