Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

(v2) ionic serve doesn't detect changes in vagrant host #759

Closed
adamdbradley opened this issue Feb 11, 2016 · 6 comments
Closed

(v2) ionic serve doesn't detect changes in vagrant host #759

adamdbradley opened this issue Feb 11, 2016 · 6 comments
Assignees

Comments

@adamdbradley
Copy link

From @cxcxcxcx on January 27, 2016 8:32

(This is for ionic v2)

I'm running ionic serve within a vagrant VM, and found that although it detects changes within the VM, but changes from the host wouldn't be respected.

On the other gulp watch works fine for my old projects.

Searching around this seems to be webpack problem, which has been resolved bug polling may need to be enabled separately: webpack/webpack#125

Is there an easy way to enable polling for the watching for ionic serve v2?

Thanks!

Copied from original issue: ionic-team/ionic-framework#5210

@adamdbradley
Copy link
Author

From @tomsun on January 28, 2016 16:15

Same issue when running ionic serve in a Docker container via Docker Toolbox on OS X

...for the same reason: In both scenarios VirtualBox's "Shared Folders" feature tends to be a part of the workflow (Edit files in the GUI on the host OS, run Node in the VM), which is why the file events do not propagate: https://www.virtualbox.org/ticket/10660

@adamdbradley
Copy link
Author

From @cxcxcxcx on January 29, 2016 8:31

The thread suggested enable --watch-poll for the webpack dev server. Not sure if there would be an equivalent for ionic serve? Thanks!

@tlancina
Copy link
Contributor

Yes, we should expose watch options for ionic serve. Although if the only real one is to use polling, perhaps just supporting --watch-poll as a flag for ionic serve would be enough.

@tomsun
Copy link

tomsun commented Feb 23, 2016

Gave this a shot: ionic-team/ionic-app-lib#73

Seems to detect js updates, but not html or sass (tested with default webpack config for an Ionic 2.0.0-beta.1 app)

( Also added an entry to the --help menu over here: tomsun@e640f4c )

@torch2424
Copy link

torch2424 commented Sep 18, 2016

@tlancina is correct, this is due to vagrant's NFS filesystem syncing. I seem to have gotten this working by adding options to the gulp task in the meantime for HTML, and CSS. For browserify/watchify, polling works as well, but takes ~2mins to build :p Would be nice to have @tomsun changes pulled in for us vagrant users! :)

Also, here's the relevant pieces of my gulpfile.js:

//Going to use polling for gulp watch because synced folders don't emit filesystem changes
//Gulp: https://github.com/floatdrop/gulp-watch/issues/213
//Browserify: http://stackoverflow.com/questions/27619248/watchify-update-event-never-fires-in-virtualbox
var watchInterval = 1000;
var watchOptions = {
    usePolling: true,
    interval: watchInterval
};

// Task to watch app folder for changes to semi e-build the app
gulp.task('watch', ['clean'], function(done) {
    runSequence(
        ['sass', 'html', 'fonts', 'scripts'],
        function() {
            gulpWatch('app/**/*.scss', watchOptions, function() {
                gulp.start('sass');
            });
            gulpWatch('app/**/*.html', watchOptions, function() {
                gulp.start('html');
            });
            buildBrowserify({
                watch: true,
                watchifyOptions: {
                    poll: true,
                    interval: watchInterval
                },
            }).on('end', done);
        }
    );
});

@jthoms1
Copy link
Contributor

jthoms1 commented Oct 28, 2016

Thanks for opening the issue. It seems that issue has been resolved. I am going to close this issue but please feel free to reopen another issue if this occurs again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants