'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!
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
