webpack-dev-server not building / compiling

The webpack-dev-server serves the result from mem­ory. It doesn’t write to file sys­tem or disk.

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

webpack result is served from / 

indi­cates that your bun­dle is served from /.

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

If you have public/index.html

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

And your bun­dled javascript is served from ‘public/assets/js’ then you need to tell web­pack to serve the assets from ‘/assets/js’ by set­ting publicPath property.

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


You may also like...