1

I have simple grunt-browserify config. This configuration works perfectly until I change any JavaScript file, then "watchify" compiles build again. Since that moment build.js fails in browser with exception: Uncaught Error: Cannot find module 'i18n'

Seems like "watchify" ingnores alias option, or Am I doing something wrong ?

browserify: {
    client: {
        src: ['app/app.js'],
        dest: 'app/build.js',
        options: {
            browserifyOptions: {
                debug: true
            },
            alias: [
                './app/dispatchers/appDispatcher.js:appDispatcher',
                './app/models/i18n.js:i18n'
            ],
            watch: true
        }
    }
}

Thank you.

Jordan Running
  • 102,619
  • 17
  • 182
  • 182
  • Update. If change is in app.js file then build.js works without exceptions. However if I change any other *.js file within project then build.js fails. – Jevgenijs Golojads Apr 20 '15 at 07:34

1 Answers1

0

Adding cache:false solves the problem. My only concern is that caching helps to speed up the process. So but turning it off I'm slowing down re-building process.

        ...
        browserifyOptions: {
            ...
            cache: false
        }
        ...

Problem comes from "module-deps" package. Following commit fixes this issue. Wait for official build and then caching option can be removed. link to commit