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

Build Bundle #10

Closed
alexisvincent opened this issue Nov 10, 2016 · 11 comments
Closed

Build Bundle #10

alexisvincent opened this issue Nov 10, 2016 · 11 comments

Comments

@alexisvincent
Copy link
Owner

I want to pass the source files through a rollup (with babel), so that I can get a nice single small bundle.

This will also allow easy usage of something like the babel runtime transform.

If anyone has some time and wants to contribute to this project. This is would appreciated.

@alexisvincent alexisvincent changed the title Setup Rollup + Babel (help wanted) Setup Rollup + Babel Nov 10, 2016
@jjrv
Copy link
Contributor

jjrv commented Nov 11, 2016

I'm currently using systemjs-builder through cbuild to bundle systemjs-hot-reloader (the version in your PR that's not merged yet). The script is here (bundle-reloader) and the resulting bundle is here with a corresponding autogenerated config.js.

cbuild is basically a wrapper around systemjs-builder that finds packages installed using npm. It attaches to the builder's normalize hook so any missing files are looked up using browser-resolve and if found, reported to the builder so it bundles them and added to config.js so SystemJS knows how to transform their paths also at run-time.

I think it works nicely at the moment. With a prebuilt bundle, Babel is then not needed for developing with hot reloading.

@alexisvincent
Copy link
Owner Author

cbuild is really interesting. I've been wanting to build a very similar thing for a few weeks now. And I'd really like to speak to you about a bit of possible collaboration. I've sent you a PM on gitter.

With regards to using it here, I still want to babel/rollup, for the following reasons.

  1. I'm not wanting to bundle a bunch of external deps. Just some simple code splitting in the project.
  2. I don't particularly want to have the module exporting a System.register api
  3. I want to make use of babel transforms here
  4. Rollup is the simplest way I know how to do what I want

cbuild for me feels like it would be better suited to bundling at the application level

@jjrv
Copy link
Contributor

jjrv commented Nov 11, 2016

Yes, it's meant for app level and bundling the reloader was basically a free side effect. If there's a way to create a more minimalistic bundle and with fewer tools, that would be better. systemjs-builder is a bit bloated IMO (depends on Babel and Traceur) but for bigger apps I can't think of an alternative that would play as nicely with SystemJS at run-time.

@alexisvincent
Copy link
Owner Author

I think actually that the best way to build this will be with systemjs-builder don't know why I didn't think of this before

@alexisvincent alexisvincent changed the title Setup Rollup + Babel Build Bundle Nov 26, 2016
@mavericken
Copy link

I'm experimenting with using jspm bundle in conjunction with systemjs-hmr & systemjs-hot-reloader. It feels like it shouldn't take much changes, but I haven't gotten it working yet.

@alexisvincent
Copy link
Owner Author

alexisvincent commented Nov 30, 2016

Does it complain that it can't find @hot?

@alexisvincent
Copy link
Owner Author

alexisvincent commented Nov 30, 2016

If so, add '@hot': {'build': false} to your meta in your config

@mavericken
Copy link

Ah, I don't have a build config yet as I am still using the CLI, "jspm bundle". I did "jspm bundle client/**/* - [systemjs-hmr]" and it worked (I'm still on [email protected]).

The way I have it working now seems nice. With everything besides systemjs-hmr in the bundle, initial load is fast, and the hot reload works on individual files so I can see changes immediately and keep my state. Still trying to muddle through more issues though (currently having trouble with hot reload getting bugged out once I rebuild the bundle). Ideally I'll have "jspm bundle --watch" going so that I don't have to deal with stale bundled code later when doing a full refresh.

@peteruithoven
Copy link

@mavericken the beta version of jspm supports this, it has a --watch flag.
Before trying this be aware that it uses a slightly different config. Install it by npm install jspm@beta.
More info: jspm.io/0.17-beta-guide/

@mavericken
Copy link

mavericken commented Dec 1, 2016

I am using the --watch flag. Current problem is that as soon as the bundle.js changes, hot reload breaks completely. It seems I can rather easily work around it by just filtering out bundle.js changes, but trying to figure out the actual problem.

Edit: I figured it out that bug, fix pull request available here: #13

@alexisvincent
Copy link
Owner Author

Bundling via rollup

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

4 participants