Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for (Web)Workers and standalone packs #9

Open
yuchi opened this issue Jan 2, 2017 · 3 comments
Open

Support for (Web)Workers and standalone packs #9

yuchi opened this issue Jan 2, 2017 · 3 comments

Comments

@yuchi
Copy link
Owner

yuchi commented Jan 2, 2017

Inside (Web)Workers you have little access to the network, that means that an asynchronous loader would simply not work. Once we have #8 in place we could do something interesting, which is packing an entry and all its dependencies in a single pack, exactly what browserify and webpack do.

This would make it trivial to build a WebWorker main script with dependencies.

The final result would look like this:

{
  main: 0,
  entries: [
    {
      path: '/o/xxxx/1.2.3/index.js',
      body: function (require, module, global, __dirname, __filename, process) {
        var DOM = require('metal-dom');
        // ...
      },
      dependencies: {
        "metal-dom": 34
      }
    },
    // after 33 other modules
    {
      path: '/o/metal-dom/2.0.0/index.js',
      body: function () { ... },
      dependencies: { ... }
    }
  ]
}
@julien
Copy link
Collaborator

julien commented Jan 17, 2017

Hi @yuchi ,

When you say that

Inside (Web)Workers you have little access to the network

WebWorkers have access to XMLHttpRequest (in "modern" browsers), are we talking about other Workers?

Thanks

@yuchi
Copy link
Owner Author

yuchi commented Jan 17, 2017

@julien I was indeed wrong, you can do xhr on WebWorkers.

@julien
Copy link
Collaborator

julien commented Jan 17, 2017

No problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants