evanw / evanw/node-source-map-support

Could multiple lines added to the generated code throw this off?

Open
#103 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
2.2k
Forks
223
PR merge metrics
No merged PRs in 30d

Description

I'm inserting multiple lines at the top of a Webpack bundle for the sake of making this work when I load the bundle in Meteor, like so:

``` js
require("source-map-support/register");
var Npm = Meteor.__mwrContext__.Npm;
var Assets = Meteor.__mwrContext__.Assets;
delete Meteor.__mwrContext__;
var require = Npm.require;

/******/ (function(modules) { // webpackBootstrap
```

The other lines are hacks that allow me to `require` the bundle (Meteor normally loads all server files via `vm.callInThisContext`. I assume that `source-map-support-will` only work if the file is required in as a module like this (if there's another way, let me know).

However one of my users reported the following error https://github.com/jedwards1211/meteor-webpack-react/issues/86:

```
/node_modules/source-map-support/node_modules/source-map/lib/source-map/source-map-consumer.js:281
W20151007-12:26:26.964(-4)? (STDERR) throw new TypeError('Column must be greater than or equal to 0, got '
W20151007-12:26:26.964(-4)? (STDERR) ^
W20151007-12:26:26.964(-4)? (STDERR) TypeError: Column must be greater than or equal to 0, got -23
W20151007-12:26:26.964(-4)? (STDERR) at SourceMapConsumer_findMapping as _findMapping
```

Could this be caused by the extra lines I added to the top of the bundle? I've read some about how source maps work, but I think you would be more prepared to answer this question than me. Thanks!

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.