Skip to content

Dynamically load JS modules #5

Description

@dannymk

Hi Aaaron,
I took your "The Ins & Outs of the Newest JavaScript: ES6" @ Udemy. It was great, you are a very good presenter and explained the material very well.

I've had this lingering question quite a while. How do I support dynamic module upload. I think it is best to give you a scenario:

  1. ES6 SPA "application-a" running on page. Application state is maintained using Redux.
  2. User "A" uploads "dyn_module.js" to website running in step 1
  3. applicaiton-a "polls/receives message/etc..." server for new modules in "well known" directory
  4. application-a loads module(s) and may dynamically establish a route that immediately becomes available in step 1.

For a moment, lets take security out of the picture as I understand the risks from that perspective.
The point is that we never know when "dyn_module.js" will be available. We don't know the module name or functionality. All we know is the well known directory on the server where the modules will be available and that we may get these uploaded/updated at any point in time while the application is running.

Solutions I have thought about:

  • Run a process on the server that repackages everything into a new app if a new file is detected. Refresh SPA in browser...

My current development environment:
React/Aurelia
Redux
WebPack

Thank you for your time. I know you are a busy guy.

Dan.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions