Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

152
Views
Snowpack does not recognize Nunjucks template in "development" mode

I have a small Web "application" that uses Snowpack and Nunjucks. I've integrated snowpack-plugin-nunjucks 0.0.3 accordingly, but I can't really test the application whenever snowpack dev is executed.

The issue is that the server starts correctly and so on, but when I browse over the exposed address, the default entry point (index.html) is not recognized actually as HTML, but as application/octet-stream. Basically, what I get is a prompt to download a file, which in turn has the correct content (from index.html).

The snowpack.config.js contains only these few settings:

/** @type { import("snowpack").SnowpackUserConfig } */
export default {
  devOptions: {
    open: "none",
  },
  env: {
    // ...
  },
  exclude: ["**/*.test.js", "**/_*.njk"],
  mount: {
    src: "/",
  },
  optimize: {
    bundle: true,
    manifest: true,
    minify: true,
    sourcemap: "inline",
    target: "es2018",
  },
  plugins: ["snowpack-plugin-nunjucks"],
};

The application's content is inside src; these are the (excerpt for some of the) few files that I have so far:

{# index.njk #}
{% extends "src/_layout.njk" %}

{% set title = "Home" %}

{% block main %}
  <main>
    <h1>Lorem ipsum dolor sit amet.</h1>
  </main>
{%- endblock %}
{# _layout.njk #}
<!doctype html>
<html lang="en">
  <head>
    <title>{{ title }}</title>
  </head>
  <body>
    {% block body %}
    <div>
      {% block main %}
      {%- endblock %}
    </div>
    {%- endblock %}
  </body>
</html>

Is this an issue with Snowpack, the Nunjucks plugin, or the combination? Not sure what could be wrong, if anything, with the current configuration settings I'm using.

Any pointers would be great!

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!