I want to import a variable from a django generated html page into my App.vue component.
My goal is to pass a String, which represent the user AuthGroup, eg. 'milkman'
, 'hairdresser'
or 'supplier'
The error Message looks like this:
Module parse failed: Unexpected token (1:1)
You may need an appropriate loader to handle this file type, currently no loaders are configured to > process this file. See https://webpack.js.org/concepts#loaders {% extends 'base.html' %} | {% load render_bundle from webpack_loader %} | {% load navtag %}
frontend.html
{% extends 'base.html' %}
{% load render_bundle from webpack_loader %}
{% load navtag %}
{% block head %}
<title>title</title>
<script>
const test = "{{ auth_group }}" // variable/string needed in App.vue
</script>
{% endblock %}
[...]
{% block content_vue %}
<div id="app">
<app></app>
</div>
{% render_bundle 'app' %}
{% endblock %}
I can't figure out how to modify webpack or find a way to import the variable from django into the vue project. FYI: The vue project is a small part of a large Django environment.