npx create-razzle-app --example with-custom-devserver-options with-custom-devserver-options
cd with-custom-devserver-options
yarn startThis example demonstrates how to use a razzle.config.js file to modify Razzle's
underlying webpack devServer configuration. It modifies the port of the devServer
in dev (razzle start).
Note that this file is not transpiled, and so you must write it with vanilla Node.js-compatible JavaScript.
// razzle.config.js
'use strict';
module.exports = {
modifyWebpackConfig(opts) {
const config = opts.webpackConfig;
if (opts.env.target === 'web' && opts.env.dev) {
config.devServer.port = 3002;
// If behind a proxy on a public domain
// config.devServer.public = 'example.com:8080';
}
return config;
},
};