0

Through npm, is there anyway possible we can get webpack to reflect javascript changes on the fly, when lite-server is running? I have to do a npm run build every single time I have JavaScript changes.

Lite-server is doing an excellent job in updating my css changes on the fly whenever I save my .scss files. But in regards to webpack and the JavaScript files, its another story.

Thanks for any tips

klewis
  • 7,459
  • 15
  • 58
  • 102

1 Answers1

1

Webpack has a watch mode.
You can either call webpack with --watch or put watch: true in your webpack config. This will keep it running and recompile if something changes.

Also consider to look into webpack-dev-server

lukas-reineke
  • 3,132
  • 2
  • 18
  • 26
  • I got it working. Thanks! But can the webpack-dev-server be configured to also watch for scss changes? not just js changes? Is that tricky to setup? – klewis Apr 13 '18 at 14:31
  • 1
    You can compile scss with webpack as well. If you do that, webpack-dev-server will watch these changes too. https://github.com/webpack-contrib/sass-loader – lukas-reineke Apr 13 '18 at 15:50