evanw / evanw/node-source-map-support

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

Aperta
#103 3 commenti 0 reazioni 0 assegnatari Vedi su GitHub
Lingua principale
JavaScript
Stelle
2.2k
Fork
223
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Descrizione

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!

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.