Custom HTML Template

When you're using JavaScript entrypoints, index.html will be generated from a HTML template file, this is the default one we use:

<!DOCTYPE html>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <meta http-equiv="X-UA-Compatible" content="ie=edge">
  <title><%= html.title %></title>

  <% if (pkg.description) { %>
    <meta name="description" content="<%= pkg.description %>">
  <% } %>

    We're sorry but <%= html.title %> doesn't work properly without JavaScript enabled. Please enable it to continue.
  <div id="app"></div>

Generated assets will be injected into this file. If you want to use another template file, create one at public/index.html and it will be automatically used.

If you're using HTML entrypoint, please check out HTML Entry.

Template Syntax

The template file uses lodash.template to interpolate data properties.

Template Data


html is basically the html option you passed here.


pkg is the data of the package.json from your project. Note that html.title defaults to


In app code you can use process.env to access embeded Environment Variables, while in the template file you access is via the envs contant.


constants is the constants option you passed here.

Last Updated: 9/17/2019, 6:04:51 PM