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

Browser support #25

Closed
Rich-Harris opened this issue Jun 16, 2015 · 2 comments
Closed

Browser support #25

Rich-Harris opened this issue Jun 16, 2015 · 2 comments

Comments

@Rich-Harris
Copy link
Contributor

It would be useful to be able to run rollup in-browser, for the sake of custom builders (cc @mbostock) and interactive demos.

There are four external dependencies - path, sander, magic-string and acorn. acorn and magic-string both work in-browser (and magic-string and its only dependency use jsnext:main, so they be bundled with Rollup). The path functions can be replaced with internal helpers without too much difficulty.

sander is a little trickier, since it's a wrapper around fs. But if there were a neat way to exclude it from the build there'd be no problem - it's possible to supply a custom load function which returns the contents of the sought module (it just so happens that the default load uses sander to read from disk).

@Rich-Harris
Copy link
Contributor Author

This is implemented in 0.11.0. Will try and get a demo site up soon

@donmccurdy
Copy link

donmccurdy commented Oct 7, 2017

Is there an example or demo? I'm wondering about doing this in the browser:

rollup.rollup({
  entry: '/foo/bar.js',
  plugins: [ ??? ]
}).then( bundle => {
  let { code, map } = bundle.generate({
    format: 'es6'   // amd, es6, iife, umd
  });
  console.log(code);
});

.. where /foo/bar.js is path relative to the current page, which might depend on other files.

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

No branches or pull requests

2 participants