Can't import bulmaCalendar in a Django project
DMunkei opened this issue · 1 comments
DMunkei commented
Is this something you can debug and fix? Send a pull request! Bug fixes and documentation fixes are welcome.
- [ x] Are you running the latest version?
- [x ] Are you reporting to the correct repository?
Bug Report
Environment
- Extension version(s): [e.g. v1.0.0, ...]
- Bulma version: [e.g. v7.1 / v7.2]
- OS: Linux Manjaro
- Browser: Firefox | Chromium
- How you are customizing the extension: no
Current Behavior
Trying to import the sample code from the Quick start
section. Fails with the following error messages.
- Firefox
Uncaught SyntaxError: ambiguous indirect export: bulmaCalendar
- Chrome
Uncaught SyntaxError: The requested module './bulma-calendar.min.js' does not provide an export named 'bulmaCalendar
Input Code
import { bulmaCalendar} from "./bulma-calendar.min.js";
$(document).ready(function() {
// Initialize the picker with the ID of the input field
const datePicker = bulmaCalendar.attach('#date-picker', {
type: 'date',
dateFormat: 'DD-MM-YYYY',
displayMode: 'inline',
});
// Add an event listener to the picker to get the selected date
datePicker.on('select', date => {
console.log(date);
});
});
Additional context/Screenshots
I'm trying to import this into a Django 4.1.5 project, that's already using bulma.io. I cloned the repo and copied the contents of bulma-calendar/dist/js
bulma-calendar/dist/css
into my static/js
static/css
folders in my Django project.
Here are the import statements for both bulma.io
and bulma-calendar
in Djangos template engine
<link rel="stylesheet" href="{% static 'css/bulma.min.css' %}">
<link rel="stylesheet" href="{% static "css/bulma-calendar.css" %}">
<script src="{% static 'js/bulma-calendar.js' %}"></script>
<script type="module" src="{% static 'js/calendar.js' %}"></script> <------- File I'm trying to import the contents in.
Steps to reproduce
- Clone repository using HTTPS
- Copy content of
bulma-calendar/dist/js
bulma-calendar/dist/css
to the static folder in a Django project - Bind the files in the base layout folder in Django
- Try to execute sample code