Search code examples
npmwebpacklite-server

How to get webpack to reflect JavaScript changes along side lite-server


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


Solution

  • 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