You need to define publicPath
in two locations: the Webpack configuration, but also the webpack-dev-middleware
options.
For instance, this is what I use (on Express, so not entirely sure if it'll work exactly the same with Sails):
const webpackDevMiddleware = require('webpack-dev-middleware');
const webpackConfig = require('./webpack.dev');
const compiler = require('webpack')(webpackConfig);
app.use(webpackDevMiddleware(compiler, {
noInfo : true,
publicPath : webpackConfig.output.publicPath
}));
(I have a separate Webpack configuration file called webpack.dev.js
)
As you can see, I just re-use the publicPath
from the Webpack configuration for the middleware.