Brunch doesn't include my module #1250

Closed
Surfoo opened this Issue Mar 22, 2016 · 8 comments

Projects

None yet

3 participants

@Surfoo
Surfoo commented Mar 22, 2016

Description

In my project, I have several js files, and when I modify a file, brunch detect changes, but the module is empty in my app.js. Example:

require.register("search.js", function(exports, require, module) {

});

I need to stop the watcher, and lauch it again. I don't have compilation issue in the terminal... :

$ brunch w
22 Mar 15:48:29 - info: compiled in 1.1 sec
22 Mar 15:48:30 - info: compiled 10 files and 2 cached into app.js, copied 87 in 655ms
22 Mar 15:48:56 - info: compiled search.js and 11 cached files into app.js in 104ms
^C

$ brunch w
22 Mar 15:49:07 - info: compiled in 1.1 sec
22 Mar 15:49:08 - info: compiled 10 files and 2 cached into app.js, copied 87 in 620ms

Environment

  1. Brunch: 2.5.2 but tested with 2.4.2
  2. Node: v5.9
  3. NPM: 3.7.3
  4. Operating system: Debian jessie

package.json contents

{
    "name": "morpheus-ui",
    "description": "",
    "private": true,
    "scripts": {
        "start": "brunch watch",
        "prod": "brunch build --production"
    },
    "devDependencies": {
        "brunch": "~2.5.0",
        "clean-css-brunch": "~2.0.0",
        "css-brunch": "~2.0.0",
        "javascript-brunch": "~2.0.0",
        "uglify-js-brunch": "~2.0.0"
    }
}

brunch config contents

'use strict';

exports.config = {
    "paths": {
        "watched": ["app", "src"],
        "public": "web"
    },
    "files": {
        "stylesheets": {
            "joinTo": "main.css",
        },
        "javascripts": {
            "joinTo": "app.js",
        }
    },
    "modules": {
        nameCleaner: function path(path) {
            return path.substring(path.lastIndexOf("/") + 1);
        }
    }
}
@paulmillr
Member

Interested in your brunch build -d output.

@Surfoo
Surfoo commented Mar 22, 2016

Here the output : http://pastebin.com/s8Ev7MPD

@goshakkk
Member

Could also be related to the race condition between the editor and the fs watcher. See this thread #1219 (comment)

@Surfoo
Surfoo commented Mar 22, 2016

I don't know, but I use Sublime text 3 over sshfs. The watcher is on the server, not on my computer.

@goshakkk
Member

@Surfoo can you test whether editing it in vim for example over ssh produces that same issue?

Also with ST over sshfs, can you try adding to your config awaitWriteFinish: true (and see if it helps), or usePolling: true (and see if it helps), or both and see if it fixes it.

@Surfoo
Surfoo commented Mar 23, 2016

I added these 2 settings and also atomic_save: true in my ST config. It's maybe overkill, but I don't have the problem right now. I'll let a comment if the problem reappears in the next few days.

Thanks for your help!

@goshakkk
Member

Great, please do report how that works for you :)

@paulmillr paulmillr closed this Mar 28, 2016
@goshakkk
Member

Adding this to the FAQ: #1361

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment