Closed svenvandescheur closed 8 years ago
Quick thoughts:
@svenvandescheur having had some time to let this sink in, I'm not sure why the imports should be auto-generated. Why not create a single bundle then, and start that with all the necessary imports?
Template:
{# templates/base.html #}
...
{% systemjs_import "imtool/main.js" %}
# static/js/main.js (mapped via imtool/main.js -> js/main.js)
import ProjectSetupView as ProjectsProjectSetupView from 'imtool/projects/ProjectSetupView';
import ProjectManagePostsView as ProjectsProjectManagePostsView from 'imtool/projects/ProjectManagePostsView';
let app = getApp(),
view = getView(),
module = `${app}${view}`;
new module();
The only thing that is then indeed needed, is exposing the current app and view name, but I'm not getting the feeling that this is something that belongs in django-systemjs anymore.
this is properly implemented in the project that the request originated for, so not something for django-systemjs
Import (poor man's) namespaced modules
import ProjectSetupView as ProjectProjectSetupView from 'projects/ProjectSetupView';
Determine the namespaced module based on current app+view
The view needs to be know, this can a auto generated mapping or something simple like:
<script data-view="balablala">