Trying to display a simple notification in a web browser using PNotify on a thymeleaf HTML page.
Added the following WebJar dependencies to the pom.xml file:
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>pnotify__core</artifactId>
<version>${pnotify.version}</version>
</dependency>
<dependency>
<groupId>org.webjars.npm</groupId>
<artifactId>pnotify__mobile</artifactId>
<version>${pnotify.version}</version>
</dependency>
PNotify version = 5.2.0
Included the following in the HTML file -
<link th:href="@{/webjars/pnotify__core/dist/PNotify.css}" rel="stylesheet" />
<link th:href="@{/webjars/pnotify__mobile/dist/PNotifyMobile.css}" rel="stylesheet" />
<script th:src="@{/webjars/pnotify__core/dist/PNotify.js}"></script>
<script th:src="@{/webjars/pnotify__mobile/dist/PNotifyMobile.js}"></script>
Confirmed that all resources are loading properly with a 200 status code. Attempting to import PNotify in JavaScript as follows-
<script type="module">
import { defaultModules } from '../webjars/pnotify__core/5.2.0/dist/PNotify.js';
</script>
Encountering the error "Uncaught SyntaxError: import not found: defaultModules" in the browser console.
The file is confirmed to exist at http://localhost:8080/webjars/pnotify__core/5.2.0/dist/PNotify.js
Seeking assistance to debug this issue as forums have been unhelpful so far. Any tips or pointers would be greatly appreciated. Thank you!