Macil / react-hot-transform

Tweak React components in real time with Browserify.
MIT License
34 stars 0 forks source link

`Invalid mapping` when used with `browserify({debug: true})` #2

Closed mikew closed 9 years ago

mikew commented 9 years ago

Works fine with debug: false, but then there's no sourcemaps. here's the example code:

var browserify = require('browserify')
var babelify = require('babelify')
var reactHotTransform = require('react-hot-transform')
var hmr = require('browserify-hmr')
var watchify = require('watchify')

var bundle = browserify('./app/scripts/index.js', {
  debug: true,
})

bundle.transform(babelify, { stage: 0 })
bundle.transform(reactHotTransform)
bundle.plugin(hmr)

return bundle.bundle()
Macil commented 9 years ago

Can you show the error message you're seeing? Can you post a full example that has the issue? Can you make sure your dependencies are up-to-date? I just tested with the following project and had no issues:

//build.js
var fs = require('fs');
var browserify = require('browserify');
var babelify = require('babelify');
var reactHotTransform = require('react-hot-transform');
var hmr = require('browserify-hmr');
var watchify = require('watchify');

var bundle = browserify('./index.js', {
  debug: true,
});

bundle.transform(babelify, { stage: 0 });
bundle.transform(reactHotTransform);
bundle.plugin(hmr);
bundle.bundle().pipe(fs.createWriteStream('bundle.js'));
//index.js
var React = require('react');
console.log('foo bar');
$ npm i browserify watchify react-hot-transform browserify-hmr babelify react
...
$ node build.js 
22:07:46 GMT-0700 (PDT) [HMR] Emitting updates
22:07:46 GMT-0700 (PDT) [HMR] Listening on localhost:3123
mikew commented 9 years ago

Can you make sure your dependencies are up-to-date?

That was the issue, updating browserify kicked everything into gear.