Currently, I am utilizing django as the backend along with a few javascript packages installed via npm. To access these packages, I have configured django to serve /node_modules by including it in the STATICFILES_DIRS. While this setup has been functional, I find the process of locating and referencing the specific js file I need within the package, followed by loading it using a
<script src="{% static ...
, to be quite cumbersome.
This approach feels somewhat impractical and makeshift. Additionally, I am encountering challenges with incorporating imports/requires within my js files. Is there a way to effectively utilize imports or am I constrained to loading everything through script tags? I speculate that this issue is stemming from django's inability to efficiently handle npm packages. I have explored the idea of webpack but remain uncertain if it can offer a solution to my dilemma. Any insights or suggestions on how to address this matter?