Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

149
Visualizações
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
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda