Enables/Disables magic HTML routes (enabled by default).
Setting it to true will enable magic HTML routes ( routes corresponding to your webpack output, in this example /main for main.js):
webpack.config.js
module.exports = {
// ...
devServer: {
magicHtml: true,
},
};Usage via CLI:
npx webpack serve --magic-html --open- The script should open
http://localhost:8080/in your default browser. - Go to
http://localhost:8080/main, you should see the text on the page itself change to readYou are viewing the magic HTML route!.
Setting it to false will disable magic HTML route (/main):
webpack.config.js
module.exports = {
// ...
devServer: {
magicHtml: false,
},
};Usage via CLI:
npx webpack serve --no-magic-html --open- The script should open
http://localhost:8080/in your default browser. - Go to
http://localhost:8080/main, you should see the text on the page itself change to readCannot GET /mainas it is not accessible.