Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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,407 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()
    ]