caleb / broccoli-fast-browserify

A caching, flexible Browserify Broccoli filter
https://github.com/caleb/broccoli-fast-browserify
BSD 3-Clause "New" or "Revised" License
14 stars 7 forks source link

Output file is always changed #8

Closed ccoenen closed 9 years ago

ccoenen commented 9 years ago

In my project, broccoli-fast-browserify will always change the output file, even though none of its inputs have been modified. This happens both with a very simple snippet in my Brocfile:

browserify = require('broccoli-fast-browserify'),
appNpm = browserify('app');

but also with a more complicated setup:

browserify = require('broccoli-fast-browserify'),
appNpm = browserify('app', {
  bundles: {
    "npm.js": {
      entryPoints: "npm.browserify"
    }
  }
});

What happens

When i change an unrelated file, a css file perhaps, npm.js will be changed as well. I can see this both by the file's mtime and by the fact that broccoli will output this table:

Slowest Trees                                 | Total
----------------------------------------------+---------------------
FastBrowserify                                | 710ms
TreeMerger                                    | 283ms

Slowest Trees (cumulative)                    | Total (avg)
----------------------------------------------+---------------------
FastBrowserify (1)                            | 710ms
TreeMerger (1)                                | 283ms

Build successful - 1083ms

I only changed app.scss, which should not have triggered browserify at all. Still, the output file changes:

mtime mismatch: ./dir/npm.js (1432289463000ms -> 1432289470000ms)
mtime mismatch: ./dir/css/app.css (1432289462000ms -> 1432289469000ms)

What i would like to happen

If there is no change to the *.browserify files, i would like the output files to remain unchanged.

caleb commented 9 years ago

I don't think that should be happening.

Can you create a small test project that shows the problem that I can look at?

ccoenen commented 9 years ago

This reproduces the issue for me: https://github.com/ccoenen/broccoli-fast-browserify-issue-8

caleb commented 9 years ago

@ccoenen Try the newest version of broccoli-fast-browserify (0.2.7). I think that might fix the issue of the npm.js file being recreated all the time.

So I believe the mtime issue is solved.


About the issue of it running the broccoli-fast-browserify plugin when you change the CSS

broccoli will still run the broccoli-fast-browserify plugin, because it's input tree has changed, but it will be really fast.

If you want to prevent broccoli-fast-browserify from running at all, use broccoli-funnel to limit the input files to js/browserify files, or put the javascript files in their own subdirectory.

Even so, I believe broccoli will still show broccoli-fast-browserify in the output table. I could not get it to not show in the table, even when I put the css and js in separate directories.

But it showed the broccoli-fast-browserify plugin taking 0ms, so I took that as a good sign :) And the npm.js file was not modified when I modified the css

ccoenen commented 9 years ago

thanks, i will try this tomorrow! 0ms certainly is negligible ;-)

ccoenen commented 9 years ago

You're right, with 0.2.7, the time is near-zero! Thanks for the update!

ccoenen commented 9 years ago

hm it's weird: my demo-project works flawlessly, now. But my actual project still rebuilds the browserify files. That's probably my fault, though. I'll keep this closed until i can prove otherwise :)

caleb commented 9 years ago

That's strange, let me know if you find out what's causing the problem. All I can think of is to blow away your node_modules directory to ensure you're running the new version :) I might have time to do more work on this next weekend if you find out anything.

ccoenen commented 6 years ago

I've removed my demo-project for this issue. I believe it started to grow mold, and this issue has been non-existent for almost three years.