webpack-dev-server not building / compiling

The webpack-dev-server serves the result from memory. It doesn’t write to file system or disk.

When you start webpack-dev-server from CLI it says

webpack result is served from / 

indicates that your bundle is served from /.

You need to tell the webpack-dev-server where your assets should be served by setting publicPath.

If you have public/index.html

// index.html
<!DOCTYPE html>
    <head> ... </head>
        <div id="app"></div>
        <script src="/assets/js/app.js"></script>

And your bundled javascript is served from ‘public/assets/js’ then you need to tell webpack to serve the assets from ‘/assets/js’ by setting publicPath property.

output: {
    path: path.join( __dirname, 'public/assets/js'),
    publicPath: 'assets/js/',
    filename: 'app.js'

You may also like...