Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

JavaScript Building a MEAN Application Creating and Editing Data in a MEAN App Create and Update Data in Angular

Matthew Hall
Matthew Hall
9,005 Points

How come webpack --watch doesn't update my angular scripts?

I was a little confused why my code wasn't successful until I realized the significance of the 'webpack --watch' command near the beginning of the video - the changes I made to my service and controller scripts weren't being remade in webpack!

I was wondering why my webpack --watch command doesn't result in any errors, but saving changes to my documents doesn't update it either?

My angular app.js contains the requires for each controller, directive, and service, and each one including app.js has a require('angular') line of code in too. The app works absolutely fine if I end the webpack --watch batch job and rerun it again manually. Is it because I'm using Sublime Text 2? Although nodemon works just fine in this.

It's not a major problem just yet, but I was wondering if anyone knows why this might be the case.

Seth Kroger
Seth Kroger
56,413 Points

I'm getting the same issue too. (Win 7)

2 Answers

Mike Ulvila
Mike Ulvila
16,268 Points

Try typing: node_modules/.bin/webpack --watch This is working correctly for me.

This fix from a similar StackOverflow question worked for me. Add a webpack configuration requirement for the old watching plugin in webpack.config.js:

    plugins: [
        new webpack.optimize.CommonsChunkPlugin(/* chunkName= */"vendor", /* filename= */"vendor.bundle.js"),
        // don't forget the comma after the existing plugin
        new webpack.OldWatchingPlugin()
    ]