browserify / watchify

watch mode for browserify builds
Other
1.79k stars 181 forks source link

Watchify subsequent builds corrupts output file #137

Closed nvartolomei closed 9 years ago

nvartolomei commented 9 years ago

Tried using ES6 classes with react and stuck on a bug, running watchify and everything is cool, it build correct bundle, but after i modify some code the bundle is corrupted.

"dependencies": {
    "6to5ify": "^4.0.0",
    "browserify": "^8.1.1",
    "react": "^0.13.0-beta.1",
    "reactify": "^1.0.0",
    "watchify": "^2.3.0"
  }

app.js

var React = require('react');

import { LapisxApp } from './components/LapisxApp.react';

React.render(
    <LapisxApp />,
    document.getElementById('react')
);

components/LapisxApp.react.js

var React = require('react');

export class LapisxApp extends React.Component {
    render() {
        return (
            <div>Hello World!</div>
        );
    }
}

watchify command:

watchify app.js -t reactify -t 6to5ify -r react -v -d -o bundle.js

On sequent builds even if the code is the same output is different.

Any ideas?

nvartolomei commented 9 years ago

Hm, everything works if I remove -r react from watchify command.

But I think there is a bug in watchify anyway, caching maybe?

Macil commented 9 years ago

I believe 6to5 supports JSX, so I don't think you need the reactify transform. I don't believe that should corrupt things though.

zertosh commented 9 years ago

Seems like the same issue as https://github.com/substack/watchify/issues/145. Can you try watchify@2.5.0?